diff --git a/Makefile b/Makefile index 1265a35c..8b7a9460 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ CLIBS=-lm -lpthread JANET_TARGET=build/janet JANET_BOOT=build/janet_boot JANET_IMPORT_LIB=build/janet.lib +JANET_LIBRARY_IMPORT_LIB=build/libjanet.lib JANET_LIBRARY=build/libjanet.so JANET_STATIC_LIBRARY=build/libjanet.a JANET_PATH?=$(LIBDIR)/janet @@ -52,6 +53,7 @@ HOSTAR?=$(AR) # Symbols are (optionally) removed later, keep -g as default! CFLAGS?=-O2 -g LDFLAGS?=-rdynamic +LIBJANET_LDFLAGS?=$(LD_FLAGS) RUN:=$(RUN) COMMON_CFLAGS:=-std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC @@ -94,10 +96,12 @@ endif ifeq ($(findstring MINGW,$(UNAME)), MINGW) CLIBS:=-lws2_32 -lpsapi -lwsock32 LDFLAGS:=-Wl,--out-implib,$(JANET_IMPORT_LIB) + LIBJANET_LDFLAGS:=-Wl,--out-implib,$(JANET_LIBRARY_IMPORT_LIB) JANET_TARGET:=$(JANET_TARGET).exe JANET_BOOT:=$(JANET_BOOT).exe endif + $(shell mkdir -p build/core build/c build/boot build/mainclient) all: $(JANET_TARGET) $(JANET_STATIC_LIBRARY) build/janet.h ifeq ($(HAS_SHARED), 1) @@ -224,7 +228,7 @@ $(JANET_TARGET): $(JANET_TARGET_OBJECTS) $(HOSTCC) $(LDFLAGS) $(BUILD_CFLAGS) -o $@ $^ $(CLIBS) $(JANET_LIBRARY): $(JANET_TARGET_OBJECTS) - $(HOSTCC) $(LDFLAGS) $(BUILD_CFLAGS) $(SONAME_SETTER)$(SONAME) -shared -o $@ $^ $(CLIBS) + $(HOSTCC) $(LIBJANET_LDFLAGS) $(BUILD_CFLAGS) $(SONAME_SETTER)$(SONAME) -shared -o $@ $^ $(CLIBS) $(JANET_STATIC_LIBRARY): $(JANET_TARGET_OBJECTS) $(HOSTAR) rcs $@ $^ @@ -339,6 +343,7 @@ install: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.pc mkdir -p '$(DESTDIR)$(JANET_PKG_CONFIG_PATH)' cp build/janet.pc '$(DESTDIR)$(JANET_PKG_CONFIG_PATH)/janet.pc' cp '$(JANET_IMPORT_LIB)' '$(DESTDIR)$(LIBDIR)' || echo 'no import lib to install (mingw only)' + cp '$(JANET_LIBRARY_IMPORT_LIB)' '$(DESTDIR)$(LIBDIR)' || echo 'no import lib to install (mingw only)' [ -z '$(DESTDIR)' ] && $(LDCONFIG) || echo "You can ignore this error for non-Linux systems or local installs" install-jpm-git: $(JANET_TARGET)