Makefile: respect user CPPFLAGS

This commit is contained in:
Lucio Sauer 2024-08-12 16:56:00 +02:00
parent 71acf45a04
commit cf62efc2ce

View file

@ -5,6 +5,7 @@
# https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git/ # https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git/
# The governing license can be found in the LICENSE file or at # The governing license can be found in the LICENSE file or at
# https://opensource.org/license/MIT. # https://opensource.org/license/MIT.
TARGETS = dist/mkcard dist/checkrom dist/dump2rom dist/x48ng
PREFIX = /usr PREFIX = /usr
DOCDIR = $(PREFIX)/doc/x48ng DOCDIR = $(PREFIX)/doc/x48ng
@ -55,10 +56,6 @@ EXTRA_WARNING_FLAGS := -Wunused-function \
endif endif
override CFLAGS := -std=c11 \ override CFLAGS := -std=c11 \
-I./src/ -D_GNU_SOURCE=1 \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) \
-DPATCHLEVEL=$(PATCHLEVEL) \
-Wall -Wextra -Wpedantic \ -Wall -Wextra -Wpedantic \
-Wformat=2 -Wshadow \ -Wformat=2 -Wshadow \
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition \ -Wwrite-strings -Wstrict-prototypes -Wold-style-definition \
@ -75,6 +72,12 @@ override CFLAGS := -std=c11 \
$(EXTRA_WARNING_FLAGS) \ $(EXTRA_WARNING_FLAGS) \
$(CFLAGS) $(CFLAGS)
override CPPFLAGS := -I./src/ -D_GNU_SOURCE=1 \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) \
-DPATCHLEVEL=$(PATCHLEVEL) \
$(CPPFLAGS)
LIBS = -lm LIBS = -lm
### lua ### lua
@ -123,27 +126,23 @@ endif
.PHONY: all clean clean-all pretty-code install mrproper .PHONY: all clean clean-all pretty-code install mrproper
all: dist/mkcard dist/checkrom dist/dump2rom dist/x48ng all: $(TARGETS)
# Binaries
dist/mkcard: src/tools/mkcard.o
$(CC) $^ -o $@ $(CFLAGS) $(LIBS)
dist/dump2rom: src/tools/dump2rom.o dist/dump2rom: src/tools/dump2rom.o
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) dist/mkcard: src/tools/mkcard.o
dist/checkrom: src/tools/checkrom.o src/romio.o dist/checkrom: src/tools/checkrom.o src/romio.o
$(CC) $^ -o $@ $(CFLAGS) $(LIBS)
dist/x48ng: $(DOTOS) dist/x48ng: $(DOTOS)
$(CC) $^ -o $@ $(CFLAGS) $(LIBS)
# Binaries
$(TARGETS):
$(CC) $^ -o $@ $(CPPFLAGS) $(CFLAGS) $(LIBS)
# Cleaning # Cleaning
clean: clean:
rm -f src/*.o src/tools/*.o src/*.dep.mk src/tools/*.dep.mk rm -f src/*.o src/tools/*.o src/*.dep.mk src/tools/*.dep.mk
mrproper: clean mrproper: clean
rm -f dist/mkcard dist/checkrom dist/dump2rom dist/x48ng rm -f $(TARGETS)
make -C dist/ROMs mrproper make -C dist/ROMs mrproper
clean-all: mrproper clean-all: mrproper