Welcome to little lamb

Code » comain » commit 650a07c

common.mk: Add support for TOOLS

author Olivier Brunel
2023-02-15 08:49:49 UTC
committer Olivier Brunel
2023-02-15 08:49:49 UTC
parent 41441cdf332ca7a5b1290169d58a7e6689bae86d

common.mk: Add support for TOOLS

Allows to create some "internal" binaries that won't be installed. Used
e.g. for generating data/files at build time.

common.mk +4 -2

diff --git a/common.mk b/common.mk
index 77c8ef7..a2dfae2 100644
--- a/common.mk
+++ b/common.mk
@@ -22,6 +22,7 @@ OBJS += $(SRCS:src/%.c=obj/%.lo)
 DEPS  = $(SRCS:src/%.c=obj/%.d) $(ASMS:src/%.S=obj/%.d)
 BINS  =
 LIBS  =
+TOOLS =
 SHARED_LIBS = $(patsubst %,lib%.so,$(LIBS))
 STATIC_LIBS = $(patsubst %,lib%.a,$(LIBS))
 SRCS_DOCS = $(wildcard doc/*.md)
@@ -29,7 +30,7 @@ DOCS = README COPYING $(SRCS_DOCS:doc/%=%)
 DATA =
 
 # to be removed upon `make clean`
-CLEAN = $(BINS) $(STATIC_LIBS) $(SHARED_LIBS) $(OBJS) $(DEPS)
+CLEAN = $(BINS) $(TOOLS) $(STATIC_LIBS) $(SHARED_LIBS) $(OBJS) $(DEPS)
 
 obj: comain
 	$(_DIR) comain/mkdirobj
@@ -133,6 +134,7 @@ repoclean: distclean
 _DIR = $(if $(V),,$(call say," DIR  ")$@;)
 _CP = $(if $(V),,$(call say,"  CP  ")$@;)
 _CC = $(if $(V),$(CC),$(call say,"  CC  ")$@;$(CC))
+_GEN = $(if $(V),,$(call say," GEN  ")$@;)
 _AR = $(if $(V),,$(call say,"  AR  ")$@;)
 _RANLIB = $(if $(V),,$(call say,"RANLIB")$@;)
 _CLEAN = $(if $(V),,$(call say,"CLEAN ");)
@@ -152,7 +154,7 @@ $(BINS) $(SHARED_LIBS) $(STATIC_LIBS) $(OBJS): | $(BUILD_DEPS)
 
 all: $(BINS) $(SHARED_LIBS) $(STATIC_LIBS) $(BUILD_DEPS)
 
-$(BINS):
+$(BINS) $(TOOLS):
 	$(_CC) -o $@ $(COMMON_CFLAGS) $(CFLAGS) $(COMMON_LDFLAGS) $(LDFLAGS) $^
 
 .PHONY: install-bins install-libs install-docs install-data install \