aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2022-10-24 09:49:51 -0500
committerCalvin Rose <calsrose@gmail.com>2022-10-24 09:49:51 -0500
commite731996a68ee70aad6dda064a1a7a581ce08d9f1 (patch)
tree51727daa892ea46c9d2d3843de5c0e5ac93b3a4e /Makefile
parentAdd easier option for adding config.mk in root directory. (diff)
Allow overriding JANETCONF_HEADER in Makefile.
This allows a configuration workflow that is a bit simpler than before and doesn't requiring applying patches. Instead, add a config.mk to source dir with JANETCONF_HEADER=myconfig.h and compile as usual. The patching workflow will of course still work exactly as before.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 8079a98b..02bd3c22 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@
sinclude config.mk
PREFIX?=/usr/local
+JANETCONF_HEADER?=src/conf/janetconf.h
INCLUDEDIR?=$(PREFIX)/include
BINDIR?=$(PREFIX)/bin
LIBDIR?=$(PREFIX)/lib
@@ -83,7 +84,7 @@ all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.h
##### Name Files #####
######################
-JANET_HEADERS=src/include/janet.h src/conf/janetconf.h
+JANET_HEADERS=src/include/janet.h $(JANETCONF_HEADER)
JANET_LOCAL_HEADERS=src/core/features.h \
src/core/util.h \
@@ -176,16 +177,16 @@ endif
build/c/shell.c: src/mainclient/shell.c
cp $< $@
-build/janet.h: $(JANET_TARGET) src/include/janet.h src/conf/janetconf.h
- ./$(JANET_TARGET) tools/patch-header.janet src/include/janet.h src/conf/janetconf.h $@
+build/janet.h: $(JANET_TARGET) src/include/janet.h $(JANETCONF_HEADER)
+ ./$(JANET_TARGET) tools/patch-header.janet src/include/janet.h $(JANETCONF_HEADER) $@
-build/janetconf.h: src/conf/janetconf.h
+build/janetconf.h: $(JANETCONF_HEADER)
cp $< $@
-build/janet.o: build/c/janet.c src/conf/janetconf.h src/include/janet.h
+build/janet.o: build/c/janet.c $(JANETCONF_HEADER) src/include/janet.h
$(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@
-build/shell.o: build/c/shell.c src/conf/janetconf.h src/include/janet.h
+build/shell.o: build/c/shell.c $(JANETCONF_HEADER) src/include/janet.h
$(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@
$(JANET_TARGET): build/janet.o build/shell.o