From 85fdaf22994ead86a43b4880cb4875094612bd72 Mon Sep 17 00:00:00 2001 From: Aleksa Vučković Date: Sun, 16 Jan 2022 14:37:35 +0100 Subject: Recompiling when included header files change --- src/Makefile | 11 +++++++++++ src/as/Makefile | 3 ++- src/c/Makefile | 6 ++++-- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 src/Makefile (limited to 'src') diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..91c565b --- /dev/null +++ b/src/Makefile @@ -0,0 +1,11 @@ +.PHONY: all build_as build_c + +all: build_as build_c + +build_as: + $(MKDIR) $(AS_OBJECT_DIR) + @$(MAKE) --directory as + +build_c: + $(MKDIR) $(C_OBJECT_DIR) + @$(MAKE) --directory c diff --git a/src/as/Makefile b/src/as/Makefile index bd5664b..c8919d7 100644 --- a/src/as/Makefile +++ b/src/as/Makefile @@ -1,5 +1,6 @@ .PHONY: all + all: $(AS_OBJECTS) -$(AS_OBJECT_DIR)/%.o: %.s +$(AS_OBJECT_DIR)/%.o: %.s Makefile $(AS) $< -o $@ diff --git a/src/c/Makefile b/src/c/Makefile index 9ee253d..b8fe609 100644 --- a/src/c/Makefile +++ b/src/c/Makefile @@ -1,6 +1,8 @@ .PHONY: all + all: $(C_OBJECTS) +$(C_OBJECT_DIR)/%.o: %.c Makefile + $(CC) $(CFLAGS) -MD -MP -c $< -o $@ -$(C_OBJECT_DIR)/%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ +-include $(C_OBJECTS:.o=.d) -- cgit v1.2.3