summaryrefslogtreecommitdiff
path: root/Make.rules
diff options
context:
space:
mode:
authorRasmus Thomsen <oss@cogitri.dev>2020-03-16 15:25:02 +0200
committerTimo Teräs <timo.teras@iki.fi>2020-03-16 15:36:46 +0200
commit4966bc5edec37adcf4a9da692e57f38e02bac9fe (patch)
tree4e7ea811fbe4db259e7df8fca4120d2f3b374cc9 /Make.rules
parent8b2efdd272862ae41d3e3aa2828f4d2c49e60abd (diff)
downloadapk-tools-4966bc5edec37adcf4a9da692e57f38e02bac9fe.tar.gz
apk-tools-4966bc5edec37adcf4a9da692e57f38e02bac9fe.tar.bz2
apk-tools-4966bc5edec37adcf4a9da692e57f38e02bac9fe.tar.xz
apk-tools-4966bc5edec37adcf4a9da692e57f38e02bac9fe.zip
build: enable building of development package
- always create .so and .a with the apk libary code - create .pc file - install headers and above mentioned files Maintainers edit: merged commits, cleaned up sed script logic, and few other minor fixes.
Diffstat (limited to 'Make.rules')
-rw-r--r--Make.rules32
1 files changed, 26 insertions, 6 deletions
diff --git a/Make.rules b/Make.rules
index 09b7831..b07cf98 100644
--- a/Make.rules
+++ b/Make.rules
@@ -69,7 +69,9 @@ CROSS_COMPILE ?=
CC := $(CROSS_COMPILE)gcc
AR := $(CROSS_COMPILE)ar
LD := $(CROSS_COMPILE)ld
+LN := ln -sf
SCDOC := scdoc
+SED := sed
INSTALL := install
INSTALLDIR := $(INSTALL) -d
@@ -80,7 +82,7 @@ CFLAGS_ALL += $(CFLAGS)
LDFLAGS ?= -g
LDFLAGS_ALL += $(LDFLAGS)
-export CC AR LD SCDOC INSTALL INSTALLDIR CFLAGS_ALL LDFLAGS_ALL
+export CC AR LD LN SCDOC SED INSTALL INSTALLDIR CFLAGS_ALL LDFLAGS_ALL
build :=
@@ -94,8 +96,8 @@ endif
ifneq ($(origin targets),file)
targets :=
endif
-ifneq ($(origin docs),file)
-docs :=
+ifneq ($(origin nontargets),file)
+nontargets :=
endif
src :=
@@ -274,11 +276,29 @@ quiet_cmd_scdoc = SCDOC $@
cmd_scdoc = $(SCDOC) < $< > $@
__scdocs := $(addprefix $(obj)/,$(sort $(scdocs-y)))
+nontargets += $(__scdocs)
docs += $(__scdocs)
$(__scdocs): $(obj)/%: $(src)/%.scd FORCE
$(call if_changed,scdoc)
+####
+# Template (.in) files
+
+quiet_cmd_sed = SED $@
+ cmd_sed = $(SED) \
+ -e "s|@EXEC_DIR@|$(SBINDIR)|" \
+ -e "s|@LIB_DIR@|$(LIBDIR)|" \
+ -e "s|@INCLUDE_DIR@|$(INCLUDEDIR)|" \
+ -e "s|@VERSION@|$(VERSION)|" \
+ $< > $@
+
+$(obj)/%: $(src)/%.in FORCE
+ $(call if_changed,sed)
+
+
+nontargets += $(addprefix $(obj)/,$(sort $(generate-y)))
+
###
# why - tell why a a target got build
ifeq ($(VERBOSE),2)
@@ -288,9 +308,9 @@ why = \
$(if $(strip $(any-prereq)),- due to: $(any-prereq), \
$(if $(arg-check), \
$(if $(cmd_$@),- due to command line change: $(arg-check), \
- $(if $(filter $@, $(targets) $(docs)), \
+ $(if $(filter $@, $(targets) $(nontargets)), \
- due to missing .cmd file, \
- - due to $(notdir $@) not in $$(targets) or $$(docs) \
+ - due to $(notdir $@) not in $$(targets) or $$(nontargets) \
) \
) \
) \
@@ -351,7 +371,7 @@ FORCE:
targets := $(wildcard $(sort $(targets)))
docs := $(wildcard $(sort $(docs)))
-cmd_files := $(wildcard $(foreach f,$(targets) $(docs),$(dir $(f)).$(notdir $(f)).cmd))
+cmd_files := $(wildcard $(foreach f,$(targets) $(nontargets),$(dir $(f)).$(notdir $(f)).cmd))
ifneq ($(cmd_files),)
include $(cmd_files)