From 998bd51425e4cd3034b04cf07b0ab16eb06a9c76 Mon Sep 17 00:00:00 2001 From: Sami Ahmed Date: Sun, 22 Mar 2026 23:14:30 -0700 Subject: [PATCH] Fix Linux headless build (makefile.unix) - Fix $(system) -> $(shell) GNU Make syntax error that broke ARCH detection - Add obj/ and obj-test/ directory creation rules for fresh clones - Remove duplicate -levent linkage - Add order-only prerequisites (| obj) to pattern rules Co-Authored-By: Claude Opus 4.6 --- src/makefile.unix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/makefile.unix b/src/makefile.unix index 60617d6..744b505 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -6,7 +6,7 @@ USE_UPNP:=0 USE_IPV6:=1 LINK:=$(CXX) -ARCH:=$(system lscpu | head -n 1 | awk '{print $2}') +ARCH:=$(shell lscpu | head -n 1 | awk '{print $$2}') DEFS=-DBOOST_SPIRIT_THREADSAFE @@ -41,7 +41,6 @@ LIBS += \ -l boost_chrono$(BOOST_LIB_SUFFIX) \ -l db_cxx$(BDB_LIB_SUFFIX) \ -l ssl \ - -l event \ -l crypto ifndef USE_UPNP @@ -200,6 +199,12 @@ ifdef USE_ZMQ OBJS += obj/zmqpublishnotifier.o endif +obj: + @mkdir -p obj + +obj-test: + @mkdir -p obj-test + all: trianglesd test check: test_triangles FORCE @@ -231,14 +236,14 @@ obj/scrypt-x86_64.o: scrypt-x86_64.S obj/scrypt-arm.o: scrypt-arm.S $(CXX) -c $(xCXXFLAGS) -MMD -o $@ $< -obj/%.o: %.cpp +obj/%.o: %.cpp | obj $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< @cp $(@:%.o=%.d) $(@:%.o=%.P); \ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \ rm -f $(@:%.o=%.d) -obj/%.o: %.c +obj/%.o: %.c | obj $(CXX) -c $(xCXXFLAGS) -fpermissive -MMD -MF $(@:%.o=%.d) -o $@ $< @cp $(@:%.o=%.d) $(@:%.o=%.P); \ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ @@ -299,7 +304,7 @@ trianglesd: $(OBJS:obj/%=obj/%) TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) -obj-test/%.o: test/%.cpp +obj-test/%.o: test/%.cpp | obj-test $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $< @cp $(@:%.o=%.d) $(@:%.o=%.P); \ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \