diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-19 23:22:13 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-19 23:22:13 -0400 |
| commit | e552fc2afcf525d0fd7a3ffe137cc28a43f224a2 (patch) | |
| tree | 76d2114e4782919913c7b2ae31b350238b1723b5 /Makefile | |
| parent | 1215fc945fe7d22010858d18f04813f90a1289d5 (diff) | |
Workaround for hashes in makefile bug
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -67,7 +67,8 @@ OSFLAGS != case $(OS) in *BSD|Darwin) echo '-D_BSD_SOURCE';; Linux) echo '-D_GNU EXTRA= G=-ggdb O=-O3 -TOMO_VERSION=$(shell awk '/^\#\# / {print $$2; exit}' CHANGES.md) +# Note: older versions of Make have buggy behavior with hash marks inside strings, so this ugly code is necessary: +TOMO_VERSION=$(shell awk 'BEGIN{hashes=sprintf("%c%c",35,35)} $$1==hashes {print $$2; exit}' CHANGES.md) GIT_VERSION=$(shell git log -1 --pretty=format:"%as_%h") CFLAGS=$(CCONFIG) $(INCLUDE_DIRS) $(EXTRA) $(CWARN) $(G) $(O) $(OSFLAGS) $(LTO) \ -DTOMO_PREFIX='"$(PREFIX)"' -DSUDO='"$(SUDO)"' -DDEFAULT_C_COMPILER='"$(DEFAULT_C_COMPILER)"' \ @@ -108,6 +109,9 @@ API_MD=$(patsubst %.yaml,%.md,$(API_YAML)) all: config.mk check-c-compiler check-libs build/lib/$(LIB_FILE) build/lib/$(AR_FILE) build/bin/$(EXE_FILE) +version: + @echo $(TOMO_VERSION) + check-c-compiler: @$(DEFAULT_C_COMPILER) -v 2>/dev/null >/dev/null \ || { printf '\033[31;1m%s\033[m\n' "You have set your DEFAULT_C_COMPILER to $(DEFAULT_C_COMPILER) in your config.mk, but I can't run it!"; exit 1; } @@ -230,4 +234,4 @@ uninstall: endif .SUFFIXES: -.PHONY: all clean install install-files install-libs uninstall test tags examples deps check-utilities check-c-compiler check-libs +.PHONY: all clean install install-files install-libs uninstall test tags examples deps check-utilities check-c-compiler check-libs version |
