Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Makefile to support Windows (MinGW-w64) #333

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ ifeq ($(OS),Linux)
LIB_MAJOR := $(BASENAME).so.$(MAJOR_VERSION)
LIB_VERSION := $(BASENAME).so.$(VERSION)
LINKER_FLAGS := -Wl,-soname,$(LIB_MAJOR)
# Windows
else ifneq (,$(findstring MINGW,$(OS)))
LIB_VERSION := $(BASENAME)-$(MAJOR_VERSION).dll
LINKER_FLAGS := -s -Wl,--out-implib,$(LIB_VERSION).a
# Mac
else ifeq ($(OS),Darwin)
LIB_BASE := $(BASENAME).dylib
Expand All @@ -41,11 +45,16 @@ $(LIBS): $(SRC) $(INCLUDE) Makefile
ar rcs $(LIB_STATIC) $(LIB_OBJ)
chmod 644 $(LIB_STATIC)
rm -f $(LIB_OBJ)
ifneq (,$(LIB_BASE))
ln -sf $(LIB_VERSION) $(LIB_BASE)
endif
mkdir -p $(addprefix build/, include lib src)
install -m 644 $(SRC) build/src
install -m 644 $(INCLUDE) build/include
mv $(LIB_VERSION) $(LIB_BASE) $(LIB_STATIC) build/lib
ifneq (,$(findstring MINGW,$(OS)))
mv $(LIB_VERSION).a build/lib
endif

build/lib/$(LIB_BASE): build/lib/$(LIB_MAJOR)

Expand All @@ -56,6 +65,10 @@ install: all
mkdir -p $(addprefix $(DESTDIR)/, src lib include $(MANDIR))
cp -R $(filter-out deb, $(wildcard build/*)) $(DESTDIR)
cp -R $(MANS) $(DESTDIR)/$(MANDIR)
ifneq (,$(findstring MINGW,$(OS)))
mkdir -p $(addprefix $(DESTDIR)/, bin)
mv -f $(DESTDIR)/lib/*.dll $(DESTDIR)/bin
endif

ifeq ($(OS),Linux)
ldconfig $(DESTDIR)/lib
Expand Down