Sun, 01 Oct 2023 14:41:17 +0200
improve Makefiles
Makefile | file | annotate | diff | comparison | revisions | |
configure | file | annotate | diff | comparison | revisions | |
make/cc.mk | file | annotate | diff | comparison | revisions | |
make/project.xml | file | annotate | diff | comparison | revisions |
1.1 --- a/Makefile Sun Sep 24 18:48:42 2023 +0200 1.2 +++ b/Makefile Sun Oct 01 14:41:17 2023 +0200 1.3 @@ -28,25 +28,25 @@ 1.4 1.5 include config.mk 1.6 1.7 -SRC = frontend.c 1.8 -SRC += c2html.c 1.9 -SRC += highlighter.c 1.10 - 1.11 -OBJ = $(SRC:%.c=build/%.o) 1.12 - 1.13 all: build build/c2html 1.14 1.15 -build/c2html: $(OBJ) 1.16 - $(CC) -o $@ $^ $(LDFLAGS) 1.17 - 1.18 -build/%.o: src/%.c 1.19 +build/c2html: build/frontend.o build/highlighter.o build/c2html.o 1.20 + $(CC) -o $@ $(LDFLAGS) $^ 1.21 + 1.22 +build/c2html.o: src/c2html.c src/c2html.h src/highlighter.h 1.23 + $(CC) -o $@ $(CFLAGS) -c $< 1.24 + 1.25 +build/frontend.o: src/frontend.c src/c2html.h src/highlighter.h 1.26 + $(CC) -o $@ $(CFLAGS) -c $< 1.27 + 1.28 +build/highlighter.o: src/highlighter.c src/highlighter.h 1.29 $(CC) -o $@ $(CFLAGS) -c $< 1.30 1.31 build: 1.32 $(MKDIR) $@ 1.33 1.34 check: all 1.35 - cd test && $(MAKE) 1.36 + cd test && $(MAKE) -s 1.37 1.38 clean: 1.39 $(RMDIR) build
2.1 --- a/configure Sun Sep 24 18:48:42 2023 +0200 2.2 +++ b/configure Sun Oct 01 14:41:17 2023 +0200 2.3 @@ -227,6 +227,28 @@ 2.4 echo no 2.5 return 0 2.6 } 2.7 +dependency_error_tools() 2.8 +{ 2.9 + printf "checking for tools... " 2.10 + # dependency tools platform="unix" 2.11 + while true 2.12 + do 2.13 + if notisplatform "unix"; then 2.14 + break 2.15 + fi 2.16 + cat >> $TEMP_DIR/make.mk << __EOF__ 2.17 +# Dependency: tools 2.18 +RMDIR=rm -fR 2.19 +MKDIR=mkdir -p 2.20 + 2.21 +__EOF__ 2.22 + echo yes 2.23 + return 1 2.24 + done 2.25 + 2.26 + echo no 2.27 + return 0 2.28 +} 2.29 2.30 2.31 2.32 @@ -249,11 +271,6 @@ 2.33 break 2.34 fi 2.35 2.36 - cat >> "$TEMP_DIR/make.mk" << __EOF__ 2.37 -MKDIR=mkdir -p 2.38 -RMDIR=rm -fR 2.39 - 2.40 -__EOF__ 2.41 break 2.42 done 2.43 break 2.44 @@ -290,6 +307,10 @@ 2.45 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ucx " 2.46 ERROR=1 2.47 fi 2.48 +if dependency_error_tools; then 2.49 + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED tools " 2.50 + ERROR=1 2.51 +fi 2.52 2.53 # Features 2.54
3.1 --- a/make/cc.mk Sun Sep 24 18:48:42 2023 +0200 3.2 +++ b/make/cc.mk Sun Oct 01 14:41:17 2023 +0200 3.3 @@ -3,6 +3,6 @@ 3.4 # 3.5 3.6 CFLAGS = 3.7 +LDFLAGS = 3.8 DEBUG_CC_FLAGS = -g 3.9 RELEASE_CC_FLAGS = -O3 -DNDEBUG 3.10 -LDFLAGS =
4.1 --- a/make/project.xml Sun Sep 24 18:48:42 2023 +0200 4.2 +++ b/make/project.xml Sun Oct 01 14:41:17 2023 +0200 4.3 @@ -2,8 +2,12 @@ 4.4 <project xmlns="http://unixwork.de/uwproj"> 4.5 <dependency> 4.6 <lang>c</lang> 4.7 - <make>MKDIR=mkdir -p</make> 4.8 - <make>RMDIR=rm -fR</make> 4.9 + </dependency> 4.10 + <dependency name="tools" platform="unix"> 4.11 + <make> 4.12 +RMDIR=rm -fR 4.13 +MKDIR=mkdir -p 4.14 + </make> 4.15 </dependency> 4.16 <dependency name="ucx"> 4.17 <test>check_lib ucx cx/list.h</test>