add some reasonable warnings/errors when PREFIX is empty

This commit is contained in:
mrdudz
2025-06-29 22:46:42 +02:00
parent 91bf4352a9
commit 831eedfb58
2 changed files with 44 additions and 15 deletions

View File

@@ -4,11 +4,22 @@ ifneq ($(SILENT),s)
$(info Using Makefile: $(realpath $(firstword $(MAKEFILE_LIST))) $(MAKECMDGOALS)) $(info Using Makefile: $(realpath $(firstword $(MAKEFILE_LIST))) $(MAKECMDGOALS))
endif endif
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util checkstyle check .PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util checkstyle check checkprefix
.SUFFIXES: .SUFFIXES:
all install zip: all zip:
@$(MAKE) -C src --no-print-directory $@
@$(MAKE) -C libsrc --no-print-directory $@
@$(MAKE) -C doc --no-print-directory $@
@$(MAKE) -C util --no-print-directory $@
@$(MAKE) -C samples --no-print-directory $@
@$(MAKE) checkprefix --no-print-directory
install:
ifndef PREFIX
$(error Error: PREFIX must be set for install to work)
endif
@$(MAKE) -C src --no-print-directory $@ @$(MAKE) -C src --no-print-directory $@
@$(MAKE) -C libsrc --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@
@$(MAKE) -C doc --no-print-directory $@ @$(MAKE) -C doc --no-print-directory $@
@@ -24,9 +35,17 @@ mostlyclean clean:
@$(MAKE) -C test --no-print-directory $@ @$(MAKE) -C test --no-print-directory $@
@$(MAKE) -C targettest --no-print-directory $@ @$(MAKE) -C targettest --no-print-directory $@
avail unavail bin: avail unavail:
# FIXME: actually not true, PREFIX is ignored?
#ifndef PREFIX
# $(error Error: PREFIX must be set for avail/unavail to work)
#endif
@$(MAKE) -C src --no-print-directory $@ @$(MAKE) -C src --no-print-directory $@
bin:
@$(MAKE) -C src --no-print-directory $@
@$(MAKE) checkprefix --no-print-directory
lib libtest: lib libtest:
@$(MAKE) -C libsrc --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@
@@ -45,6 +64,11 @@ util:
%: %:
@$(MAKE) -C libsrc --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@
checkprefix:
ifndef PREFIX
$(warning Warning: PREFIX is empty - make install will not work)
endif
# check the code style # check the code style
checkstyle: checkstyle:
@$(MAKE) -C .github/checks --no-print-directory $@ @$(MAKE) -C .github/checks --no-print-directory $@

View File

@@ -101,6 +101,11 @@ ifdef CROSS_COMPILE
endif endif
all bin: $(PROGS) all bin: $(PROGS)
ifeq ($(MAKELEVEL),0)
ifndef PREFIX
$(warning Warning: PREFIX is empty - make install will not work)
endif
endif
mostlyclean: mostlyclean:
$(call RMDIR,../wrk) $(call RMDIR,../wrk)