Skip to content

Commit 7a78e72

Browse files
committed
src/Makefile: if CONFIGFILE not found and in current dir, try parent dir
1 parent 7086ed0 commit 7a78e72

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Makefile

+16-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,22 @@ THIS_MAKEFILE:=$(lastword $(MAKEFILE_LIST))
1010

1111
CONFIGFILE ?=../config.mk
1212
$(info Using config file ${CONFIGFILE})
13-
include ${CONFIGFILE}
13+
14+
CONFIGFILEPATH:=$(shell ls ${CONFIGFILE} >/dev/null 2>/dev/null && realpath ${CONFIGFILE})
15+
ifeq ($(CONFIGFILEPATH),)
16+
ifeq ($(shell dirname ${CONFIGFILE}),.)
17+
CONFIGFILEPATH:=$(shell ls ../${CONFIGFILE} >/dev/null 2>/dev/null && realpath ../${CONFIGFILE})
18+
ifneq ($(CONFIGFILEPATH),)
19+
$(info Config file ${CONFIGFILE} not found; using ../${CONFIGFILE})
20+
endif
21+
endif
22+
endif
23+
24+
ifeq ($(CONFIGFILEPATH),)
25+
$(error Config file ${CONFIGFILE} not found)
26+
else
27+
include ${CONFIGFILEPATH}
28+
endif
1429

1530
CC ?= cc
1631
AWK ?= awk

0 commit comments

Comments
 (0)