1
0
mirror of https://github.com/ScrelliCopter/VGM-Tools synced 2025-02-21 04:09:25 +11:00

makefile builds objects into a build artifacts directory

also forgot to commit the header
This commit is contained in:
2019-10-02 12:37:08 +10:00
parent 2a654f25e8
commit a76bb43ec1
3 changed files with 18 additions and 3 deletions

View File

@@ -4,7 +4,8 @@ CFLAGS := -std=c99 -O2 -pipe -Wall -Wextra -pedantic
LDFLAGS := $(CFLAGS)
OBJECT := $(SOURCE:%.c=%.o)
OBJDIR := .obj_$(TARGET)
OBJECT := $(patsubst %.c, $(OBJDIR)/%.o, $(SOURCE))
DEPEND := $(OBJECT:%.o=%.d)
.PHONY: default all clean
@@ -14,10 +15,13 @@ all: $(TARGET)
$(TARGET): $(OBJECT)
$(CC) $(LDFLAGS) $^ -o $@
%.o: %.c
$(OBJDIR):
mkdir -p $@
$(OBJDIR)/%.o: %.c | $(OBJDIR)
$(CC) $(CFLAGS) -MMD -c $< -o $@
-include: $(DEPEND)
clean:
rm -f $(TARGET) $(OBJECT) $(DEPEND)
rm -rf $(OBJDIR)