commit e53f136921c99b5609b5b884a72d5714b0c384fb
parent fc148faf8c283d28c01bac304a6141f06350338a
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Sun, 19 Jun 2022 16:04:26 +0200
Minor update of the POSIX Make
Diffstat:
2 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
@@ -53,7 +53,7 @@ SRC =\
OBJ = $(SRC:.c=.o)
DEP = $(SRC:.c=.d)
-build_library: $(DEP) .config
+build_library: .config $(DEP)
@$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) libs3d.so
$(OBJ): config.mk
@@ -63,7 +63,7 @@ libs3d.so: $(OBJ)
@$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o $@ $(OBJ)
.config: Makefile
- @echo "Setup .config"
+ @echo "Find packages"
@if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
@if ! $(PKG_CONFIG) --atleast-version $(EMBREE_VERSION) embree; then \
@@ -72,7 +72,7 @@ libs3d.so: $(OBJ)
.SUFFIXES: .c .d .o
.c.d:
- @echo "Computing dependencies for $<"
+ @echo "DEP $@"
@$(CC) $(CFLAGS) $(INCS) -MM -MT "$(@:.d=.o) $@" $< -MF $@
.c.o:
@@ -83,7 +83,8 @@ libs3d.so: $(OBJ)
# Installation
################################################################################
pkg:
- sed -e 's#@PREFIX@#$(PREFIX)#g' \
+ @echo "Setup s3d.pc"
+ @sed -e 's#@PREFIX@#$(PREFIX)#g' \
-e 's#@VERSION@#$(VERSION)#g' \
-e 's#@RSYS_VERSION@#$(RSYS_VERSION)#g' \
s3d.pc.in > s3d.pc
@@ -143,7 +144,7 @@ TEST_OBJ = $(TEST_SRC:.c=.o)
TEST_DEP = $(TEST_SRC:.c=.d)
test: build_tests
- @$(MAKE) -fMakefile -f.test $$(for i in $(TEST_DEP); do echo -f"$${i}"; done) test_run
+ @$(SHELL) make.sh run_test $(TEST_SRC)
build_tests: build_library $(TEST_DEP) .test
@$(MAKE) -fMakefile -f.test $$(for i in $(TEST_DEP); do echo -f"$${i}"; done) test_bin
@@ -152,9 +153,6 @@ build_tests: build_library $(TEST_DEP) .test
@echo "Setup tests"
@$(SHELL) make.sh config_test $(TEST_SRC) > .test
-test_run: test_bin
- @$(SHELL) make.sh run_test $(TEST_SRC)
-
clean_test:
@$(SHELL) make.sh clean_test $(TEST_SRC)
diff --git a/config.mk b/config.mk
@@ -1,25 +1,36 @@
-VERSION = 0.8.0
+VERSION = 0.8.0 # Library version
PREFIX = /usr/local
-
PKG_CONFIG = pkg-config
+################################################################################
+# Dependencies
+################################################################################
+RSYS_VERSION=0.6
RSYS_INC = $$($(PKG_CONFIG) --cflags rsys)
RSYS_LIB = $$($(PKG_CONFIG) --libs rsys)
+
+EMBREE_VERSION=3.13
EMBREE_INC = $$($(PKG_CONFIG) --cflags embree)
EMBREE_LIB = $$($(PKG_CONFIG) --libs embree)
INCS=$(RSYS_INC) $(EMBREE_INC)
LIBS=$(RSYS_LIB) $(EMBREE_LIB)
-CPPFLAGS = -DNDEBUG
-WFLAGS = -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Wconversion -Wshadow
-CFLAGS = -O3 -std=c99 -pedantic -fPIC -fvisibility=hidden -fstrict-aliasing\
- -Wl,--no-undefined $(WFLAGS) $(CPPFLAGS)
-LDFLAGS = -shared
+################################################################################
+# Compilation options
+################################################################################
+CC = cc # Compiler
-CC = cc
+CPPFLAGS = -DNDEBUG
+WFLAGS =\
+ -Wall\
+ -Wconversion\
+ -Wextra\
+ -Wmissing-declarations\
+ -Wmissing-prototypes\
+ -Wshadow
-# Dependency version
-RSYS_VERSION=0.6
-EMBREE_VERSION=3.13
+CFLAGS = -O3 -std=c99 -pedantic -fPIC -fvisibility=hidden -fstrict-aliasing\
+ -Wl,--no-undefined $(WFLAGS) $(CPPFLAGS) # Compiler options
+LDFLAGS = -shared # Linker options