src/Makefile

changeset 73
b383b1b61cbf
parent 69
186e41b332d9
child 74
ed9a5ffd1f13
--- a/src/Makefile	Fri Sep 29 20:30:31 2023 +0200
+++ b/src/Makefile	Sun Oct 01 14:25:26 2023 +0200
@@ -25,8 +25,8 @@
 
 BUILD_DIR = ../build
 SRC = arguments.c bfile_heuristics.c cline.c regex_parser.c scanner.c settings.c string_list.c
-
 OBJ = $(SRC:%.c=$(BUILD_DIR)/%.o)
+CFLAGS += -DVERSION='"$(VERSION)"'
 
 all: $(BUILD_DIR)/cline FORCE
 	echo "Build successful."
@@ -37,10 +37,40 @@
 
 $(BUILD_DIR)/cline: $(OBJ)
 	echo "Linking executable..."
-	$(CC) $(LDFLAGS) -o $@ $(OBJ)
-
-$(BUILD_DIR)/%.o: %.c
-	echo "Compiling $<"
-	$(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -c -o $@ $<
+	$(CC) $(LDFLAGS) -o $@ $^
 
 FORCE:
+
+$(BUILD_DIR)/arguments.o: arguments.c arguments.h stdinc.h string_list.h
+	echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/bfile_heuristics.o: bfile_heuristics.c bfile_heuristics.h \
+ stdinc.h
+	echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/cline.o: cline.c cline.h stdinc.h settings.h string_list.h \
+ bfile_heuristics.h regex_parser.h scanner.h arguments.h
+	echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/regex_parser.o: regex_parser.c regex_parser.h string_list.h \
+ stdinc.h
+	echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/scanner.o: scanner.c scanner.h stdinc.h settings.h \
+ string_list.h bfile_heuristics.h regex_parser.h
+	echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/settings.o: settings.c settings.h stdinc.h string_list.h \
+ bfile_heuristics.h regex_parser.h
+	echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/string_list.o: string_list.c string_list.h stdinc.h
+	echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+

mercurial