summaryrefslogtreecommitdiff
path: root/sofort
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:55 +0000
commit443c84214e536ef95a4798ec3d5bdf940a207ded (patch)
tree633736701c7c5a93976e3fed36df9ed415001a60 /sofort
parent2fd40a1fbfa35a7f04f71e4e55863cc8a425ce56 (diff)
downloadsltdl-443c84214e536ef95a4798ec3d5bdf940a207ded.tar.bz2
sltdl-443c84214e536ef95a4798ec3d5bdf940a207ded.tar.xz
build system: posix make support: refactored project-agnostic inference rules.
Diffstat (limited to 'sofort')
-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
5 files changed, 45 insertions, 1 deletions
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