# HG changeset patch # User Mike Becker # Date 1696163126 -7200 # Node ID b383b1b61cbf604acad1245c3b88ca057e67872f # Parent f99a6d5b268b1bc851a608fdc259125b8c2c1b73 improve Makefiles diff -r f99a6d5b268b -r b383b1b61cbf Makefile --- 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 diff -r f99a6d5b268b -r b383b1b61cbf make/cc.mk --- 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 diff -r f99a6d5b268b -r b383b1b61cbf src/Makefile --- 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 $< +