aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2008-10-17 15:40:08 +0100
committerEric B Munson <ebmunson@us.ibm.com>2008-10-21 11:14:23 +0100
commite23e851e93b1d071f13053b8aa03f8961f583f12 (patch)
tree7529a5e7fc26ecf50e7ace11e6f8735235a2d8e0 /Makefile
parent82ce959dfa0edbe4a33d8a632508552106b7d7ec (diff)
downloadlibhugetlbfs-e23e851e93b1d071f13053b8aa03f8961f583f12.tar.gz
add a new private utilities library
Add a new private utilities library consisting of various useful helpers normally hidden within libhugetlbfs. Extend the library local marker idiom to include a private utilities marker __pu_. When we build libhugetlbfs these are forced local when building libhugetlbfs_privutils these are the only routines exported. This makes it very hard for the two libraries to interfere with each other when both are linked to the same binary, which is particularly important when testing the library; we must test the real one. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Acked-by: Mel Gorman <mel@csn.ul.ie> Acked-by: Adam Litke <agl@us.ibm.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 26 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 2d5a120..1bb4589 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,8 @@ PREFIX = /usr/local
EXEDIR = /bin
LIBOBJS = hugeutils.o version.o init.o morecore.o debug.o alloc.o shm.o kernel-features.o
-INSTALL_OBJ_LIBS = libhugetlbfs.so libhugetlbfs.a
+LIBPUOBJS = init_privutils.o debug.o
+INSTALL_OBJ_LIBS = libhugetlbfs.so libhugetlbfs.a libhugetlbfs_privutils.so
BIN_OBJ_DIR=obj
INSTALL_BIN = hugectl hugeedit hugeadm pagesize
INSTALL_HEADERS = hugetlbfs.h
@@ -20,7 +21,7 @@ NODEPTARGETS=<version.h> <clean>
INSTALL = install
-LDFLAGS += --no-undefined-version -Wl,--version-script=version.lds -ldl
+LDFLAGS += --no-undefined-version -ldl
CFLAGS ?= -O2 -g
CFLAGS += -Wall -fPIC
CPPFLAGS += -D__LIBHUGETLBFS__
@@ -154,7 +155,7 @@ all: libs tests tools
.PHONY: tests libs
-libs: $(foreach file,$(INSTALL_OBJ_LIBS),$(OBJDIRS:%=%/$(file)))
+libs: $(foreach file,$(INSTALL_OBJ_LIBS),$(OBJDIRS:%=%/$(file))) $(BIN_OBJ_DIR)/libhugetlbfs_privutils.a
tests: libs # Force make to build the library first
tests: tests/all
@@ -227,11 +228,31 @@ obj64/libhugetlbfs.a: $(LIBOBJS64)
obj32/libhugetlbfs.so: $(LIBOBJS32)
@$(VECHO) LD32 "(shared)" $@
- $(CC32) $(LDFLAGS) -Wl,-soname,$(notdir $@) -shared -o $@ $^ $(LDLIBS)
+ $(CC32) $(LDFLAGS) -Wl,--version-script=version.lds -Wl,-soname,$(notdir $@) -shared -o $@ $^ $(LDLIBS)
obj64/libhugetlbfs.so: $(LIBOBJS64)
@$(VECHO) LD64 "(shared)" $@
- $(CC64) $(LDFLAGS) -Wl,-soname,$(notdir $@) -shared -o $@ $^ $(LDLIBS)
+ $(CC64) $(LDFLAGS) -Wl,--version-script=version.lds -Wl,-soname,$(notdir $@) -shared -o $@ $^ $(LDLIBS)
+
+#obj32/libhugetlbfs_privutils.a: $(LIBPUOBJS:%=obj32/%)
+# @$(VECHO) AR32 $@
+# $(AR) $(ARFLAGS) $@ $^
+#
+#obj64/libhugetlbfs_privutils.a: $(LIBPUOBJS:%=obj64/%)
+# @$(VECHO) AR64 $@
+# $(AR) $(ARFLAGS) $@ $^
+
+$(BIN_OBJ_DIR)/libhugetlbfs_privutils.a: $(LIBPUOBJS:%=$(BIN_OBJ_DIR)/%)
+ @$(VECHO) ARHOST $@
+ $(AR) $(ARFLAGS) $@ $^
+
+obj32/libhugetlbfs_privutils.so: $(LIBPUOBJS:%=obj32/%)
+ @$(VECHO) LD32 "(shared)" $@
+ $(CC32) $(LDFLAGS) -Wl,--version-script=privutils.lds -Wl,-soname,$(notdir $@) -shared -o $@ $^ $(LDLIBS)
+
+obj64/libhugetlbfs_privutils.so: $(LIBPUOBJS:%=obj64/%)
+ @$(VECHO) LD64 "(shared)" $@
+ $(CC64) $(LDFLAGS) -Wl,--version-script=privutils.lds -Wl,-soname,$(notdir $@) -shared -o $@ $^ $(LDLIBS)
obj32/%.i: %.c
@$(VECHO) CPP $@