59 lines
1.5 KiB
Diff
59 lines
1.5 KiB
Diff
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -14,7 +14,11 @@ $(info $(MSG_PREFIX)Using AR=$(AR))
|
|
$(info $(MSG_PREFIX)Using LD=$(LD))
|
|
|
|
PROG := abc
|
|
+
|
|
OS := $(shell uname -s)
|
|
+ifneq ($(filter MINGW%,$(OS)),)
|
|
+OS := MINGW
|
|
+endif
|
|
|
|
MODULES := \
|
|
$(wildcard src/ext*) \
|
|
@@ -142,10 +146,15 @@ ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD))
|
|
LIBS += -ldl
|
|
endif
|
|
|
|
-ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD Darwin))
|
|
+ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD Darwin MINGW))
|
|
LIBS += -lrt
|
|
endif
|
|
|
|
+# For PathMatchSpecA.
|
|
+ifeq ($(OS), MINGW)
|
|
+ LIBS = -lshlwapi
|
|
+endif
|
|
+
|
|
ifdef ABC_USE_LIBSTDCXX
|
|
LIBS += -lstdc++
|
|
$(info $(MSG_PREFIX)Using explicit -lstdc++)
|
|
@@ -155,7 +164,7 @@ $(info $(MSG_PREFIX)Using CFLAGS=$(CFLAGS))
|
|
CXXFLAGS += $(CFLAGS) -std=c++17 -fno-exceptions
|
|
|
|
SRC :=
|
|
-GARBAGE := core core.* *.stackdump ./tags $(PROG) arch_flags
|
|
+GARBAGE := core core.* *.stackdump ./tags $(PROG) arch_flags $(PROG).in
|
|
|
|
.PHONY: all default tags clean docs cmake_info
|
|
|
|
@@ -221,9 +230,17 @@ clean:
|
|
tags:
|
|
etags `find . -type f -regex '.*\.\(c\|h\)'`
|
|
|
|
+ifeq ($(OS), MINGW)
|
|
+$(PROG): $(OBJ)
|
|
+ @echo "$(MSG_PREFIX)\`\` Constructing Response File:" $(notdir @$@.in)
|
|
+ $(file >$@.in,$^ $(LDFLAGS) $(LIBS))
|
|
+ @echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@)
|
|
+ $(VERBOSE)$(LD) -o $@ @$@.in
|
|
+else
|
|
$(PROG): $(OBJ)
|
|
@echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@)
|
|
$(VERBOSE)$(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
|
|
+endif
|
|
|
|
lib$(PROG).a: $(LIBOBJ)
|
|
@echo "$(MSG_PREFIX)\`\` Linking:" $(notdir $@)
|