use makefile instead simple build.sh #7

This commit is contained in:
tylen 2024-09-25 10:55:54 +00:00 committed by Vasily Davydov
parent 204aaad082
commit 8dac3405ec
2 changed files with 21 additions and 1 deletions

View File

@ -13,4 +13,4 @@ jobs:
uses: actions/checkout@v3
- name: Run build script
run: |
./build.sh
make

20
Makefile Normal file
View File

@ -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