Improved Makefiles to build the "shared" library (DLL).
This commit is contained in:
parent
82b16fb608
commit
40b4e2d5af
@ -23,8 +23,13 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(firstword $(filter %-mingw32 %-cygwin,$(DUMPMACHINE))),)
|
ifeq ($(firstword $(filter %-mingw32 %-cygwin,$(DUMPMACHINE))),)
|
||||||
|
DLL_LDFLAGS = -fPIC -shared
|
||||||
|
DLL_SUFFIX := .so
|
||||||
|
else
|
||||||
|
DLL_LDFLAGS = -shared -Wl,--out-implib,$@.a
|
||||||
EXE_SUFFIX := .exe
|
EXE_SUFFIX := .exe
|
||||||
|
DLL_SUFFIX := .dll
|
||||||
ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
||||||
XLDFLAGS += -Wl,--large-address-aware
|
XLDFLAGS += -Wl,--large-address-aware
|
||||||
endif
|
endif
|
||||||
|
@ -10,6 +10,7 @@ ALL_PATH := $(SRC_PATH) $(OBJ_PATH) $(LIB_PATH)
|
|||||||
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
||||||
OBJ_FILE := $(addprefix $(OBJ_PATH)/,$(patsubst %.c,%.o,$(notdir $(SRC_FILE))))
|
OBJ_FILE := $(addprefix $(OBJ_PATH)/,$(patsubst %.c,%.o,$(notdir $(SRC_FILE))))
|
||||||
LIB_FILE := $(LIB_PATH)/libhashset-1.a
|
LIB_FILE := $(LIB_PATH)/libhashset-1.a
|
||||||
|
DLL_FILE := $(LIB_PATH)/libhashset-1$(DLL_SUFFIX)
|
||||||
|
|
||||||
.PHONY: all build clean test
|
.PHONY: all build clean test
|
||||||
|
|
||||||
@ -17,10 +18,13 @@ all: clean build
|
|||||||
|
|
||||||
test: build
|
test: build
|
||||||
|
|
||||||
build: $(ALL_PATH) $(LIB_FILE)
|
build: $(ALL_PATH) $(LIB_FILE) $(DLL_FILE)
|
||||||
|
|
||||||
$(LIB_FILE): $(OBJ_FILE)
|
$(LIB_FILE): $(OBJ_FILE)
|
||||||
$(AR) rcs $@ $(OBJ_FILE)
|
$(AR) rcs $@ $^
|
||||||
|
|
||||||
|
$(DLL_FILE): $(SRC_FILE)
|
||||||
|
$(CC) $(CFLAGS) $(DLL_LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
$(OBJ_FILE):
|
$(OBJ_FILE):
|
||||||
$(CC) $(CFLAGS) -c $(SRC_PATH)/$(patsubst %.o,%.c,$(notdir $@)) -o $@
|
$(CC) $(CFLAGS) -c $(SRC_PATH)/$(patsubst %.o,%.c,$(notdir $@)) -o $@
|
||||||
@ -29,4 +33,4 @@ $(ALL_PATH):
|
|||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf $(LIB_FILE) $(OBJ_PATH)/*.o
|
rm -vf $(LIB_FILE) $(DLL_FILE) $(DLL_FILE).a $(OBJ_PATH)/*.o
|
||||||
|
Loading…
Reference in New Issue
Block a user