commit 1748b7a20693ea9a7b21532089a097a3502c8f2c
parent 60464b225c3cf2c92e46bdd1e6ef4c07b0cb7a7c
Author: Jan Pobrislo <ccx@te2000.cz>
Date: Fri, 6 Dec 2024 21:16:10 +0000
Simplify makefile for uniformly linked executables
Diffstat:
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/Makefile b/src/Makefile
@@ -1,36 +1,28 @@
all: tools
.PHONY: all
-define miniroon_link =
-miniroon_tool_names+=$(1)
-build/miniroon-$(1): $$(patsubst %,build/%,$$(obj_$(1))) ../link
- ../link -o '$$@' $$(patsubst %,build/%,$$(obj_$(1)))
-endef
+miniroon_tool_names:=read verify
define miniroon_autolink =
-miniroon_tool_names+=$(1)
include build/cmd_$(1).c.deps.mk
build/miniroon-$(1): $$(LINKDEP_cmd_$(1)__c) ../link build/cmd_$(1).c.deps.mk
../link -o '$$@' $$(LINKDEP_cmd_$(1)__c)
endef
-
-#obj_read:=cmd_read.o bytebuffer.o netstring.o header.o
-$(eval $(call miniroon_autolink,read))
-
-#obj_verify:=cmd_verify.o bytebuffer.o netstring.o hmac_sha2_256.o header.o envmap.o caveats.o miniroon_caveat_name_perfhash.o caveat_env_is.o caveat_env_absent.o caveat_env_fnmatch.o
-$(eval $(call miniroon_autolink,verify))
+$(foreach var,$(miniroon_tool_names),$(eval $(call miniroon_autolink,$(var))))
tools:=$(patsubst %,build/miniroon-%,$(miniroon_tool_names))
tools: $(tools)
.PHONY: tools
-%_perfhash.c %_perfhash.h: %_perfhash.txt ../genhash
- ../genhash '$*_perfhash' '$<'
-
clean:
rm -r $(tools) build
.PHONY: clean
+## pattern rules:
+
+%_perfhash.c %_perfhash.h: %_perfhash.txt ../genhash
+ ../genhash '$*_perfhash' '$<'
+
build/%.c.i: %.c ../cc build/.exists
../cc -E -C -o '$@' '$*.c'