star-ck

Describe the radiative properties of gas mixtures
git clone git://git.meso-star.fr/star-ck.git
Log | Files | Refs | README | LICENSE

commit 7daa7d50e7ba0509b91042443ea2d15794a3d0a2
parent 773646e5166973e7d6870847dd7c4a7f5ae95559
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 13 Oct 2023 10:09:06 +0200

Partially link static library object files

Make hidden symbols local to the relocatable object to avoid conflicts
with internal symbols in another static library. In release mode, delete
all symbols not required for relocation processing, but keep them in
debug mode for... debugging purposes.

Diffstat:
MMakefile | 9+++++++--
Mconfig.mk | 6++++++
2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -43,10 +43,14 @@ $(DEP) $(OBJ): config.mk $(LIBNAME_SHARED): $(OBJ) $(CC) $(CFLAGS) $(RSYS_CFLAGS) -o $@ $(OBJ) $(LDFLAGS) $(SOFLAGS) $(RSYS_LIBS) -lm -$(LIBNAME_STATIC): $(OBJ) +$(LIBNAME_STATIC): libsck.o $(AR) -rc $@ $? $(RANLIB) $@ +libsck.o: $(OBJ) + $(LD) -r $(OBJ) -o $@ + $(OBJCOPY) $(OCPFLAGS) $@ + .config: config.mk @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \ echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi @@ -97,7 +101,8 @@ uninstall: all: build_library build_tests clean: clean_test - rm -f $(OBJ) $(TEST_OBJ) $(LIBNAME) .config .test sck.pc sck-local.pc + rm -f $(OBJ) $(TEST_OBJ) $(LIBNAME) + rm -f .config .test libsck.o sck.pc sck-local.pc distclean: clean rm -f $(DEP) $(TEST_DEP) diff --git a/config.mk b/config.mk @@ -12,6 +12,8 @@ BUILD_TYPE = RELEASE ################################################################################ AR = ar CC = cc +LD = ld +OBJCOPY = objcopy PKG_CONFIG = pkg-config RANLIB = ranlib @@ -58,3 +60,7 @@ SOFLAGS = -shared -Wl,--no-undefined LDFLAGS_DEBUG = LDFLAGS_RELEASE = -s LDFLAGS = $(LDFLAGS_$(BUILD_TYPE)) + +OCPFLAGS_DEBUG = --localize-hidden +OCPFLAGS_RELEASE = --localize-hidden --strip-unneeded +OCPFLAGS = $(OCPFLAGS_$(BUILD_TYPE))