From 51197251c464a742c5bef5a67c6da222d32b14d3 Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 4 Jun 2023 10:57:37 +0200 Subject: makefile: automatic dependency generation --- Makefile | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 64e2354..3379e44 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ SRC=main.c io.c mem.c parse.c lex.c type.c targ.c eval.c ir.c irdump.c abi0.c regalloc.c amd64/sysv.c CFLAGS=-Wall -std=c11 -pedantic OBJ=$(patsubst %.c,obj/%.o,$(SRC)) +DEP=$(OBJ:.o=.d) OUT=cchomp all: CFLAGS += -g -Og @@ -17,21 +18,11 @@ $(OUT): $(OBJ) obj/%.o: %.c common.h @mkdir -p `dirname $@` - $(CC) $(CFLAGS) -c -o $@ $< - -ir.h: op.def intrin.def -obj/main.o: parse.h -obj/parse.o: parse.h ir.h -obj/ir.o: ir.h -obj/irdump.o: ir.h -obj/lex.o: parse.h -obj/eval.o: parse.h -obj/io.o: parse.h keywords.def -obj/abi0.o: ir.h -obj/regalloc.o: ir.h -obj/amd64/sysv.o: ir.h amd64/all.h + $(CC) $(CFLAGS) -MMD -MP -MT $@ -MF obj/$*.d -c -o $@ $< clean: $(RM) -r obj/ $(OUT) .PHONY: clean + +-include $(DEP) -- cgit v1.2.3