summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-04-10 10:40:45 +0000
committermidipix <writeonce@midipix.org>2021-04-10 20:54:59 +0000
commit48a561e1a19b88cb8a5d9d44cefcabbc068061cc (patch)
tree57b546934b90a6752e2976de4d1caa6378d80e8a
parent6611f10f0d25856f586e166a3d66158bb6d1c9d8 (diff)
downloadtpax-48a561e1a19b88cb8a5d9d44cefcabbc068061cc.tar.bz2
tpax-48a561e1a19b88cb8a5d9d44cefcabbc068061cc.tar.xz
build system: posix make support: refactored project-agnostic inference rules.
-rw-r--r--Makefile.in50
-rw-r--r--sofort/ccenv/ccenv.sh2
-rw-r--r--sofort/core/_infer/infer_modern.mk19
-rw-r--r--sofort/core/_infer/infer_posix.mk19
-rw-r--r--sofort/core/defs.mk2
-rw-r--r--sofort/core/infer.mk4
6 files changed, 67 insertions, 29 deletions
diff --git a/Makefile.in b/Makefile.in
index 7e4ee78..ed90b5f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,10 @@
# Makefile.in: primary common build logic.
# this file is covered by COPYING.SOFORT.
+.POSIX:
+
+.SUFFIXES: .a .c .s .o .lo .ao
+
PACKAGE = @package@
NICKNAME = @nickname@
PROJECT_DIR = @project_dir@
@@ -37,6 +41,7 @@ SRCBALL_URL = @srcball_url@
SRCBALL_SHA256 = @srcball_sha256@
MAKE = @make@
+MAKEMODE = posix
BUILD = @build@
HOST = @host@
@@ -129,13 +134,6 @@ APP_LINKING_OPT = @app_linking_opt@
INSTALL_HEADERS_OPT = @install_headers_opt@
-.cflags-host:
- @printf '%s' "$(CFLAGS)"
-
-.cflags-native:
- @printf '%s' "$(NATIVE_CFLAGS)"
-
-.SUFFIXES:
all:
install:
@@ -145,6 +143,13 @@ static:
install-extras:
install-app-extras:
+.cflags-host:
+ @printf '%s' "$(CFLAGS)"
+
+.cflags-native:
+ @printf '%s' "$(NATIVE_CFLAGS)"
+
+
include ./ccenv/host.mk
include ./ccenv/native.mk
@@ -155,6 +160,7 @@ include $(PROJECT_DIR)/sofort/core/defs.mk
include $(PROJECT_DIR)/sofort/core/pkgconf.mk
include $(PROJECT_DIR)/sofort/core/version.mk
include $(PROJECT_DIR)/sofort/core/flavor.mk
+include $(PROJECT_DIR)/sofort/core/infer.mk
include $(PROJECT_DIR)/project/osforce.mk
include $(PROJECT_DIR)/project/tree.mk
@@ -166,24 +172,6 @@ include $(PROJECT_DIR)/project/extras.mk
include $(PROJECT_DIR)/project/overrides.mk
-$(APP_SRCS:%.c=%.o): CFLAGS_STATIC = $(CFLAGS_APP)
-
-src/%.lo: $(SOURCE_DIR)/src/%.c $(ALL_HEADERS) host.tag tree.tag
- $(CC) -c -o $@ $< $(CFLAGS_SHARED)
-
-src/%.o: $(SOURCE_DIR)/src/%.c $(ALL_HEADERS) host.tag tree.tag
- $(CC) -c -o $@ $< $(CFLAGS_STATIC)
-
-lib/%$(OS_LIB_PREFIXED_SUFFIX)$(VER_XYZ)$(OS_LIB_SUFFIXED_SUFFIX):
- $(SHARED_LIB_CMD) $@ $^ $(SHARED_LIB_LDFLAGS)
-
-lib/%$(OS_ARCHIVE_EXT):
- mkdir -p lib
- rm -f $@
- $(AR) rcs $@ $^
-
-
-
all: package-shared package-static app
install: package-install-app
@@ -256,8 +244,14 @@ app-objs: dirs $(APP_OBJS)
+$(APP_OBJS): $(ALL_HEADERS) host.tag tree.tag
+
+$(SHARED_OBJS): $(ALL_HEADERS) host.tag tree.tag
+
+$(STATIC_OBJS): $(ALL_HEADERS) host.tag tree.tag
+
+
$(SHARED_LIB): $(SHARED_OBJS)
-$(SHARED_LIB): LDFLAGS_SHARED += $(LDFLAGS_IMPLIB)
$(STATIC_LIB): $(STATIC_OBJS)
@@ -265,7 +259,7 @@ $(APP): $(PACKAGE_APP)
$(DEFAULT_APP): $(STATIC_OBJS) $(APP_OBJS)
rm -f app.tag
- $(CC) -o $@ $^ $(LDFLAGS_APP)
+ $(CC) -o $@ $(STATIC_OBJS) $(APP_OBJS) $(LDFLAGS_APP)
$(SHARED_APP): $(DSO_REF_SOLINK) $(APP_OBJS) $(SHARED_SOLINK)
rm -f app.tag
@@ -273,7 +267,7 @@ $(SHARED_APP): $(DSO_REF_SOLINK) $(APP_OBJS) $(SHARED_SOLINK)
$(STATIC_APP): $(STATIC_OBJS) $(APP_OBJS)
rm -f app.tag
- $(CC) -static -o $@ $^ $(LDFLAGS_STATIC)
+ $(CC) -static -o $@ $(STATIC_OBJS) $(APP_OBJS) $(LDFLAGS_STATIC)
dirs: dirs.tag
diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index 623ac38..a9fdc96 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -1372,6 +1372,7 @@ ccenv_common_init()
ccenv_cflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" \
OS_DSO_EXRULES=default \
OS_SONAME=symlink \
+ OS_ARCHIVE_EXT='.a' \
.cflags-host)
ccenv_cc="$mb_user_cc"
@@ -1385,6 +1386,7 @@ ccenv_common_init()
ccenv_cflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" \
OS_DSO_EXRULES=default \
OS_SONAME=symlink \
+ OS_ARCHIVE_EXT='.a' \
.cflags-native)
ccenv_cc="$mb_native_cc"
diff --git a/sofort/core/_infer/infer_modern.mk b/sofort/core/_infer/infer_modern.mk
new file mode 100644
index 0000000..e7db2a6
--- /dev/null
+++ b/sofort/core/_infer/infer_modern.mk
@@ -0,0 +1,19 @@
+# infer_modern.mk: modern make target- and inference rules.
+# this file is covered by COPYING.SOFORT.
+
+src/%.ao: $(SOURCE_DIR)/src/%.c
+ $(CC) -c -o $@ $< $(CFLAGS_APP)
+
+src/%.lo: $(SOURCE_DIR)/src/%.c
+ $(CC) -c -o $@ $< $(CFLAGS_SHARED)
+
+src/%.o: $(SOURCE_DIR)/src/%.c
+ $(CC) -c -o $@ $< $(CFLAGS_STATIC)
+
+$(SHARED_LIB):
+ $(SHARED_LIB_CMD) $@ $^ $(SHARED_LIB_LDFLAGS) $(LDFLAGS_IMPLIB)
+
+lib/%$(OS_ARCHIVE_EXT):
+ mkdir -p lib
+ rm -f $@
+ $(AR) rcs $@ $^
diff --git a/sofort/core/_infer/infer_posix.mk b/sofort/core/_infer/infer_posix.mk
new file mode 100644
index 0000000..3938325
--- /dev/null
+++ b/sofort/core/_infer/infer_posix.mk
@@ -0,0 +1,19 @@
+# infer_posix.mk: posix make target- and inference rules.
+# this file is covered by COPYING.SOFORT.
+
+.c.ao:
+ $(CC) -c -o $@ $< $(CFLAGS_APP)
+
+.c.lo:
+ $(CC) -c -o $@ $< $(CFLAGS_SHARED)
+
+.c.o:
+ $(CC) -c -o $@ $< $(CFLAGS_STATIC)
+
+$(SHARED_LIB):
+ $(SHARED_LIB_CMD) $@ $(SHARED_OBJS) $(SHARED_LIB_LDFLAGS) $(LDFLAGS_IMPLIB)
+
+$(STATIC_LIB):
+ mkdir -p lib
+ rm -f $@
+ $(AR) rcs $@ $(STATIC_OBJS)
diff --git a/sofort/core/defs.mk b/sofort/core/defs.mk
index 7e120bc..2622cff 100644
--- a/sofort/core/defs.mk
+++ b/sofort/core/defs.mk
@@ -9,7 +9,7 @@ ARCH_LOBJS += $(ARCH_SRCS:.c=.lo)
ARCH_OBJS += $(ARCH_SRCS:.c=.o)
APP_LOBJS += $(APP_SRCS:.c=.lo)
-APP_OBJS += $(APP_SRCS:.c=.o)
+APP_OBJS += $(APP_SRCS:.c=.ao)
SHARED_OBJS += $(COMMON_LOBJS) $(ARCH_LOBJS)
STATIC_OBJS += $(COMMON_OBJS) $(ARCH_OBJS)
diff --git a/sofort/core/infer.mk b/sofort/core/infer.mk
new file mode 100644
index 0000000..8a1c6dd
--- /dev/null
+++ b/sofort/core/infer.mk
@@ -0,0 +1,4 @@
+# infer.mk: top-level handling of inference rules.
+# this file is covered by COPYING.SOFORT.
+
+include $(PROJECT_DIR)/sofort/core/_infer/infer_$(MAKEMODE).mk