diff options
author | Lukas Larsson <[email protected]> | 2013-08-13 17:14:11 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2013-08-21 15:20:04 +0200 |
commit | 20e0509d4e04fada3019639bc82d78b89f06b0fc (patch) | |
tree | d780872721c18782e4bdb7d9fc0f340363acbe38 /lib/asn1/c_src/Makefile | |
parent | a27e9776c839aa9fed9e71e3d06a33720377e293 (diff) | |
download | otp-20e0509d4e04fada3019639bc82d78b89f06b0fc.tar.gz otp-20e0509d4e04fada3019639bc82d78b89f06b0fc.tar.bz2 otp-20e0509d4e04fada3019639bc82d78b89f06b0fc.zip |
erts: Add option to include nifs statically
Both crypto and asn1 are supported.
Diffstat (limited to 'lib/asn1/c_src/Makefile')
-rw-r--r-- | lib/asn1/c_src/Makefile | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/lib/asn1/c_src/Makefile b/lib/asn1/c_src/Makefile index 70238335c4..ded4b73d1b 100644 --- a/lib/asn1/c_src/Makefile +++ b/lib/asn1/c_src/Makefile @@ -46,12 +46,11 @@ else TYPEMARKER = endif -EI_LIBDIR = $(ERL_TOP)/lib/erl_interface/obj$(TYPEMARKER)/$(TARGET) - # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- CFLAGS = $(DED_INCLUDES) $(EI_INCLUDES) $(DED_CFLAGS) +STATIC_CFLAGS = $(DED_INCLUDES) $(EI_INCLUDES) $(DED_STATIC_CFLAGS) LDFLAGS += $(DED_LDFLAGS) # ---------------------------------------------------- @@ -59,18 +58,38 @@ LDFLAGS += $(DED_LDFLAGS) # ---------------------------------------------------- NIF_OBJ_FILES = $(OBJDIR)/asn1_erl_nif.o +NIF_STATIC_OBJ_FILES = $(OBJDIR)/asn1_erl_nif_static.o - +# Module and shared lib have to have same name of +# static nifs to work ifeq ($(TARGET),win32) -NIF_SHARED_OBJ_FILE = $(LIBDIR)/asn1_erl_nif.dll +NIF_SHARED_OBJ_FILE = $(LIBDIR)/asn1rt_nif.dll +NIF_LIB_FILE = $(LIBDIR)/asn1rt_nif.lib CLIB_FLAGS = LN=cp else -NIF_SHARED_OBJ_FILE = $(LIBDIR)/asn1_erl_nif.so +NIF_SHARED_OBJ_FILE = $(LIBDIR)/asn1rt_nif.so +NIF_LIB_FILE = $(LIBDIR)/asn1rt_nif.a CLIB_FLAGS = -lc LN= ln -s endif +ifeq ($(USING_VC),yes) +AR_OUT=-out: +AR_FLAGS= +else +AR_OUT= +ifeq ($(V),0) +AR_FLAGS=rc +else +AR_FLAGS=rcv +endif +endif + +ifndef RANLIB +RANLIB=true +endif + # ---------------------------------------------------- # Targets # ---------------------------------------------------- @@ -81,6 +100,8 @@ opt: $(NIF_SHARED_OBJ_FILE) debug: opt +static_lib: $(NIF_LIB_FILE) + clean: rm -f core *~ rm -f $(LIBDIR)/* @@ -96,6 +117,13 @@ docs: $(OBJDIR)/%.o: %.c $(V_CC) -c $(CFLAGS) -O3 -o $@ $< +$(OBJDIR)/%_static.o: %.c + $(V_CC) -c $(STATIC_CFLAGS) -O3 -o $@ $< + +$(NIF_LIB_FILE): $(NIF_STATIC_OBJ_FILES) + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(NIF_STATIC_OBJ_FILES) + $(V_RANLIB) $@ + $(NIF_SHARED_OBJ_FILE): $(NIF_OBJ_FILES) $(V_LD) $(LDFLAGS) -o $(NIF_SHARED_OBJ_FILE) $(NIF_OBJ_FILES) $(CLIB_FLAGS) $(LIBS) |