improve Makefiles

Sun, 01 Oct 2023 14:25:26 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 01 Oct 2023 14:25:26 +0200
changeset 73
b383b1b61cbf
parent 72
f99a6d5b268b
child 74
ed9a5ffd1f13

improve Makefiles

Makefile file | annotate | diff | comparison | revisions
make/cc.mk file | annotate | diff | comparison | revisions
src/Makefile file | annotate | diff | comparison | revisions
--- a/Makefile	Fri Sep 29 20:30:31 2023 +0200
+++ b/Makefile	Sun Oct 01 14:25:26 2023 +0200
@@ -24,7 +24,7 @@
 VERSION=1.4.1
 
 all: build config.mk FORCE
-	@cd src && $(MAKE) -s VERSION=$(VERSION)
+	@cd src && $(MAKE) VERSION=$(VERSION)
 
 install:
 	@cd src && $(MAKE) -s install
--- a/make/cc.mk	Fri Sep 29 20:30:31 2023 +0200
+++ b/make/cc.mk	Sun Oct 01 14:25:26 2023 +0200
@@ -3,9 +3,6 @@
 #
 
 CFLAGS =
+LDFLAGS =
 DEBUG_CC_FLAGS = -g
 RELEASE_CC_FLAGS = -O3 -DNDEBUG
-LDFLAGS =
-
-SHLIB_CFLAGS = -fPIC
-SHLIB_LDFLAGS = -shared
\ No newline at end of file
--- 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