diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00bf9aa..984aa31 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,4 +13,4 @@ jobs: uses: actions/checkout@v3 - name: Run build script run: | - ./build.sh + make diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d66bf1c --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +CC = gcc +CFLAGS = -Wall -ggdb +SRCS = $(shell find ./src -type f -name "*.c") +BUILD_DIR = $(shell git rev-parse --show-toplevel)/build +OBJS = $(SRCS:.c=.o) + +all: $(BUILD_DIR)/cdo + +$(BUILD_DIR)/cdo: $(OBJS) + @mkdir -p $(BUILD_DIR) + $(CC) $(CFLAGS) -o $@ $^ + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + rm -rf $(BUILD_DIR) $(OBJS) + +.PHONY: all