Skip to content

Commit

Permalink
src/Makefile: if CONFIGFILE not found and in current dir, try parent …
Browse files Browse the repository at this point in the history
…dir (#268)
  • Loading branch information
liquidaty authored Nov 9, 2024
1 parent 43f73e4 commit 478e284
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@ THIS_MAKEFILE:=$(lastword $(MAKEFILE_LIST))

CONFIGFILE ?=../config.mk
$(info Using config file ${CONFIGFILE})
include ${CONFIGFILE}

CONFIGFILEPATH:=$(shell ls ${CONFIGFILE} >/dev/null 2>/dev/null && realpath ${CONFIGFILE})
ifeq ($(CONFIGFILEPATH),)
ifeq ($(shell dirname ${CONFIGFILE}),.)
CONFIGFILEPATH:=$(shell ls ../${CONFIGFILE} >/dev/null 2>/dev/null && realpath ../${CONFIGFILE})
ifneq ($(CONFIGFILEPATH),)
$(info Config file ${CONFIGFILE} not found; using ../${CONFIGFILE})
endif
endif
endif

ifeq ($(CONFIGFILEPATH),)
$(error Config file ${CONFIGFILE} not found)
else
include ${CONFIGFILEPATH}
endif

CC ?= cc
AWK ?= awk
Expand Down

0 comments on commit 478e284

Please sign in to comment.