diff options
author | Johnny Richard <johnny@johnnyrichard.com> | 2023-04-14 20:55:38 +0200 |
---|---|---|
committer | Johnny Richard <johnny@johnnyrichard.com> | 2023-04-14 20:55:38 +0200 |
commit | e0f96e02d6277f92b24ea3afaa49d6c0a7a6731c (patch) | |
tree | 0399b18a0fd6f32267fc8570e20075c9a3e3d7cd /Makefile | |
parent | be27abdc5d7895d612237803277766621601662a (diff) |
build: Move *.c to src folder
We want to have different folders for src and objs files.
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -1,4 +1,18 @@ -all: pipac +TARGET := pipac +SRC_DIR := src +BUILD_DIR := build -pipac: pipac.c - $(CC) pipac.c -o pipac +SRCS := $(wildcard $(SRC_DIR)/*.c) +OBJS := $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRCS)) + +.PHONY: all +all: $(TARGET) + +$(TARGET): $(BUILD_DIR) $(OBJS) + $(CC) $(OBJS) -o $(TARGET) $(CFLAGS) + +$(BUILD_DIR): + @mkdir -p $@ + +$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c + $(CC) $(CFLAGS) -c $< -o $@ |