summaryrefslogtreecommitdiffstats
path: root/src/Make_cyg_ming.mak
diff options
context:
space:
mode:
Diffstat (limited to 'src/Make_cyg_ming.mak')
-rw-r--r--src/Make_cyg_ming.mak58
1 files changed, 49 insertions, 9 deletions
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak
index 20ed903..8aeba67 100644
--- a/src/Make_cyg_ming.mak
+++ b/src/Make_cyg_ming.mak
@@ -130,7 +130,6 @@ ifndef STATIC_STDCPLUS
STATIC_STDCPLUS=no
endif
-
# Link against the shared version of libwinpthread by default. Set
# STATIC_WINPTHREAD to "yes" to link against static version instead.
ifndef STATIC_WINPTHREAD
@@ -140,6 +139,12 @@ endif
# This is used when STATIC_STDCPLUS=yes.
HAS_GCC_EH=yes
+# Reduce the size of the executables by using the --gc-sections linker
+# option. Set USE_GC_SECTIONS to "no" if you see any issues with this.
+ifndef USE_GC_SECTIONS
+USE_GC_SECTIONS=yes
+endif
+
# If the user doesn't want gettext, undefine it.
ifeq (no, $(GETTEXT))
GETTEXT=
@@ -179,7 +184,7 @@ ifeq ($(CROSS),yes)
ifndef CROSS_COMPILE
CROSS_COMPILE = i586-pc-mingw32msvc-
endif
-DEL = rm
+DEL = rm -f
MKDIR = mkdir -p
DIRSLASH = /
else
@@ -207,7 +212,7 @@ CROSS_COMPILE =
# In this case, unix-like commands can be used.
#
ifneq (sh.exe, $(SHELL))
-DEL = rm
+DEL = rm -f
MKDIR = mkdir -p
DIRSLASH = /
else
@@ -386,14 +391,19 @@ endif
# Python3 interface:
# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
-# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
+# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 38)
ifdef PYTHON3
ifndef DYNAMIC_PYTHON3
DYNAMIC_PYTHON3=yes
endif
+ ifndef DYNAMIC_PYTHON3_STABLE_ABI
+ ifeq (yes,$(DYNAMIC_PYTHON3))
+DYNAMIC_PYTHON3_STABLE_ABI=yes
+ endif
+ endif
ifndef PYTHON3_VER
-PYTHON3_VER=36
+PYTHON3_VER=38
endif
ifeq ($(DYNAMIC_PYTHON3_STABLE_ABI),yes)
PYTHON3_NAME=python3
@@ -1001,6 +1011,9 @@ EXELFLAGS += -s
endif
ifeq ($(COVERAGE),yes)
EXELFLAGS += --coverage
+ else ifndef MZSCHEME
+EXELFLAGS += -nostdlib
+EXECFLAGS = -DUSE_OWNSTARTUP
endif
DEFINES += $(DEF_GUI) -DVIMDLL
OBJ += $(GUIOBJ) $(CUIOBJ)
@@ -1093,6 +1106,16 @@ LIB += -lgcc_eh
LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
endif
+# To reduce the file size
+ifeq (yes, $(USE_GC_SECTIONS))
+CFLAGS += -ffunction-sections -fno-asynchronous-unwind-tables
+CXXFLAGS += -fasynchronous-unwind-tables
+LFLAGS += -Wl,--gc-sections
+ ifeq (yes, $(VIMDLL))
+EXELFLAGS += -Wl,--gc-sections
+ endif
+endif
+
ifeq (yes, $(MAP))
LFLAGS += -Wl,-Map=$(TARGET).map
endif
@@ -1122,14 +1145,25 @@ $(EXEOBJG): | $(OUTDIR)
$(EXEOBJC): | $(OUTDIR)
ifeq ($(VIMDLL),yes)
+ ifneq ($(findstring -nostdlib,$(EXELFLAGS)),)
+ # -Wl,--entry needs to be specified when -nostdlib is used.
+ ifeq ($(ARCH),x86-64)
+EXEENTRYC = -Wl,--entry=wmainCRTStartup
+EXEENTRYG = -Wl,--entry=wWinMainCRTStartup
+ else ifeq ($(ARCH),i686)
+EXEENTRYC = -Wl,--entry=_wmainCRTStartup
+EXEENTRYG = -Wl,--entry=_wWinMainCRTStartup@0
+ endif
+ endif
+
$(TARGET): $(OBJ)
$(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid -lgdi32 $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) $(SODIUMLIB)
$(GVIMEXE): $(EXEOBJG) $(VIMDLLBASE).dll
- $(CC) -L. $(EXELFLAGS) -mwindows -o $@ $(EXEOBJG) -l$(VIMDLLBASE)
+ $(CC) -L. $(EXELFLAGS) -mwindows -o $@ $(EXEOBJG) -l$(VIMDLLBASE) $(EXEENTRYG)
$(VIMEXE): $(EXEOBJC) $(VIMDLLBASE).dll
- $(CC) -L. $(EXELFLAGS) -o $@ $(EXEOBJC) -l$(VIMDLLBASE)
+ $(CC) -L. $(EXELFLAGS) -o $@ $(EXEOBJC) -l$(VIMDLLBASE) $(EXEENTRYC)
else
$(TARGET): $(OBJ)
$(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) $(SODIUMLIB)
@@ -1160,10 +1194,13 @@ notags:
clean:
-$(DEL) $(OUTDIR)$(DIRSLASH)*.o
+ -$(DEL) $(OUTDIR)$(DIRSLASH)*.gcno
+ -$(DEL) $(OUTDIR)$(DIRSLASH)*.gcda
-$(DEL) $(OUTDIR)$(DIRSLASH)*.res
-$(DEL) $(OUTDIR)$(DIRSLASH)pathdef.c
-rmdir $(OUTDIR)
-$(DEL) $(MAIN_TARGET) vimrun.exe install.exe uninstall.exe
+ -$(DEL) *.gcno *.gcda
-$(DEL) *.map
ifdef PERL
-$(DEL) if_perl.c
@@ -1297,6 +1334,9 @@ $(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(GUI_INCL) version.h
$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL)
$(CC) -c $(CFLAGS) if_cscope.c -o $@
+$(OUTDIR)/if_lua.o: if_lua.c $(INCL)
+ $(CC) -c $(CFLAGS:-fno-asynchronous-unwind-tables=) if_lua.c -o $@
+
$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP)
$(CC) -c $(CFLAGS) if_mzsch.c -o $@
@@ -1330,10 +1370,10 @@ $(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
$(CC) -c $(CFLAGS) netbeans.c -o $@
$(OUTDIR)/os_w32exec.o: os_w32exe.c $(INCL)
- $(CC) -c $(CFLAGS) -UFEAT_GUI_MSWIN os_w32exe.c -o $@
+ $(CC) -c $(CFLAGS) -UFEAT_GUI_MSWIN $(EXECFLAGS) os_w32exe.c -o $@
$(OUTDIR)/os_w32exeg.o: os_w32exe.c $(INCL)
- $(CC) -c $(CFLAGS) os_w32exe.c -o $@
+ $(CC) -c $(CFLAGS) $(EXECFLAGS) os_w32exe.c -o $@
$(OUTDIR)/os_win32.o: os_win32.c $(INCL) $(MZSCHEME_INCL)
$(CC) -c $(CFLAGS) os_win32.c -o $@