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
     1.1 --- a/Makefile	Fri Sep 29 20:30:31 2023 +0200
     1.2 +++ b/Makefile	Sun Oct 01 14:25:26 2023 +0200
     1.3 @@ -24,7 +24,7 @@
     1.4  VERSION=1.4.1
     1.5  
     1.6  all: build config.mk FORCE
     1.7 -	@cd src && $(MAKE) -s VERSION=$(VERSION)
     1.8 +	@cd src && $(MAKE) VERSION=$(VERSION)
     1.9  
    1.10  install:
    1.11  	@cd src && $(MAKE) -s install
     2.1 --- a/make/cc.mk	Fri Sep 29 20:30:31 2023 +0200
     2.2 +++ b/make/cc.mk	Sun Oct 01 14:25:26 2023 +0200
     2.3 @@ -3,9 +3,6 @@
     2.4  #
     2.5  
     2.6  CFLAGS =
     2.7 +LDFLAGS =
     2.8  DEBUG_CC_FLAGS = -g
     2.9  RELEASE_CC_FLAGS = -O3 -DNDEBUG
    2.10 -LDFLAGS =
    2.11 -
    2.12 -SHLIB_CFLAGS = -fPIC
    2.13 -SHLIB_LDFLAGS = -shared
    2.14 \ No newline at end of file
     3.1 --- a/src/Makefile	Fri Sep 29 20:30:31 2023 +0200
     3.2 +++ b/src/Makefile	Sun Oct 01 14:25:26 2023 +0200
     3.3 @@ -25,8 +25,8 @@
     3.4  
     3.5  BUILD_DIR = ../build
     3.6  SRC = arguments.c bfile_heuristics.c cline.c regex_parser.c scanner.c settings.c string_list.c
     3.7 -
     3.8  OBJ = $(SRC:%.c=$(BUILD_DIR)/%.o)
     3.9 +CFLAGS += -DVERSION='"$(VERSION)"'
    3.10  
    3.11  all: $(BUILD_DIR)/cline FORCE
    3.12  	echo "Build successful."
    3.13 @@ -37,10 +37,40 @@
    3.14  
    3.15  $(BUILD_DIR)/cline: $(OBJ)
    3.16  	echo "Linking executable..."
    3.17 -	$(CC) $(LDFLAGS) -o $@ $(OBJ)
    3.18 -
    3.19 -$(BUILD_DIR)/%.o: %.c
    3.20 -	echo "Compiling $<"
    3.21 -	$(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -c -o $@ $<
    3.22 +	$(CC) $(LDFLAGS) -o $@ $^
    3.23  
    3.24  FORCE:
    3.25 +
    3.26 +$(BUILD_DIR)/arguments.o: arguments.c arguments.h stdinc.h string_list.h
    3.27 +	echo "Compiling $<"
    3.28 +	$(CC) -o $@ $(CFLAGS) -c $<
    3.29 +
    3.30 +$(BUILD_DIR)/bfile_heuristics.o: bfile_heuristics.c bfile_heuristics.h \
    3.31 + stdinc.h
    3.32 +	echo "Compiling $<"
    3.33 +	$(CC) -o $@ $(CFLAGS) -c $<
    3.34 +
    3.35 +$(BUILD_DIR)/cline.o: cline.c cline.h stdinc.h settings.h string_list.h \
    3.36 + bfile_heuristics.h regex_parser.h scanner.h arguments.h
    3.37 +	echo "Compiling $<"
    3.38 +	$(CC) -o $@ $(CFLAGS) -c $<
    3.39 +
    3.40 +$(BUILD_DIR)/regex_parser.o: regex_parser.c regex_parser.h string_list.h \
    3.41 + stdinc.h
    3.42 +	echo "Compiling $<"
    3.43 +	$(CC) -o $@ $(CFLAGS) -c $<
    3.44 +
    3.45 +$(BUILD_DIR)/scanner.o: scanner.c scanner.h stdinc.h settings.h \
    3.46 + string_list.h bfile_heuristics.h regex_parser.h
    3.47 +	echo "Compiling $<"
    3.48 +	$(CC) -o $@ $(CFLAGS) -c $<
    3.49 +
    3.50 +$(BUILD_DIR)/settings.o: settings.c settings.h stdinc.h string_list.h \
    3.51 + bfile_heuristics.h regex_parser.h
    3.52 +	echo "Compiling $<"
    3.53 +	$(CC) -o $@ $(CFLAGS) -c $<
    3.54 +
    3.55 +$(BUILD_DIR)/string_list.o: string_list.c string_list.h stdinc.h
    3.56 +	echo "Compiling $<"
    3.57 +	$(CC) -o $@ $(CFLAGS) -c $<
    3.58 +

mercurial