xref: /vim-8.2.3635/src/GvimExt/Make_ming.mak (revision 5c829bf2)
1f4b8e57fSBram Moolenaar# Project: gvimext
2f4b8e57fSBram Moolenaar# Generates gvimext.dll with gcc.
3abfa9efbSBram Moolenaar# To be used with MingW and Cygwin.
4f4b8e57fSBram Moolenaar#
5f4b8e57fSBram Moolenaar# Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000
6f4b8e57fSBram Moolenaar# Now it is allocated dymanically by the linker by evaluating all DLLs
7f4b8e57fSBram Moolenaar# already loaded in memory. The binary image contains as well information
8f4b8e57fSBram Moolenaar# for automatic pseudo-rebasing, if needed by the system. ALV 2004-02-29
9f4b8e57fSBram Moolenaar
10f4b8e57fSBram Moolenaar# If cross-compiling set this to yes, else set it to no
11f4b8e57fSBram MoolenaarCROSS = no
12f4b8e57fSBram Moolenaar#CROSS = yes
13f4b8e57fSBram Moolenaar# For the old MinGW 2.95 (the one you get e.g. with debian woody)
14f4b8e57fSBram Moolenaar# set the following variable to yes and check if the executables are
15f4b8e57fSBram Moolenaar# really named that way.
16f4b8e57fSBram Moolenaar# If you have a newer MinGW or you are using cygwin set it to no and
17f4b8e57fSBram Moolenaar# check also the executables
18f4b8e57fSBram MoolenaarMINGWOLD = no
19f4b8e57fSBram Moolenaar
20b0d3f878SBram Moolenaar# Link against the shared versions of libgcc/libstdc++ by default.  Set
21b0d3f878SBram Moolenaar# STATIC_STDCPLUS to "yes" to link against static versions instead.
22b0d3f878SBram MoolenaarSTATIC_STDCPLUS=no
23b0d3f878SBram Moolenaar#STATIC_STDCPLUS=yes
24b0d3f878SBram Moolenaar
25b0d3f878SBram Moolenaar# Note: -static-libstdc++ is not available until gcc 4.5.x.
26b0d3f878SBram MoolenaarLDFLAGS += -shared
27b0d3f878SBram Moolenaarifeq (yes, $(STATIC_STDCPLUS))
28b0d3f878SBram MoolenaarLDFLAGS += -static-libgcc -static-libstdc++
29b0d3f878SBram Moolenaarendif
30b0d3f878SBram Moolenaar
31f4b8e57fSBram Moolenaarifeq ($(CROSS),yes)
32a40c500aSBram MoolenaarDEL = rm
33f4b8e57fSBram Moolenaarifeq ($(MINGWOLD),yes)
342369e35bSBram MoolenaarCXXFLAGS := -O2 -fvtable-thunks
35f4b8e57fSBram Moolenaarelse
362369e35bSBram MoolenaarCXXFLAGS := -O2
37f4b8e57fSBram Moolenaarendif
38f4b8e57fSBram Moolenaarelse
392369e35bSBram MoolenaarCXXFLAGS := -O2
40a40c500aSBram Moolenaarifneq (sh.exe, $(SHELL))
41a40c500aSBram MoolenaarDEL = rm
42a40c500aSBram Moolenaarelse
43a40c500aSBram MoolenaarDEL = del
44a40c500aSBram Moolenaarendif
45f4b8e57fSBram Moolenaarendif
4647cff3a4SBram Moolenaar# Set the default $(WINVER) to make it work with WinXP.
4747cff3a4SBram Moolenaarifndef WINVER
4847cff3a4SBram MoolenaarWINVER = 0x0501
4947cff3a4SBram Moolenaarendif
5048f80c27SBram MoolenaarCXX := $(CROSS_COMPILE)g++
51b0d3f878SBram MoolenaarWINDRES := $(CROSS_COMPILE)windres
52*5c829bf2SBram Moolenaar# this used to have --preprocessor, but it's no longer supported
53*5c829bf2SBram MoolenaarWINDRES_FLAGS =
549c601618SBram MoolenaarLIBS :=  -luuid -lgdi32
55f4b8e57fSBram MoolenaarRES  := gvimext.res
56f4b8e57fSBram MoolenaarDEFFILE = gvimext_ming.def
57f4b8e57fSBram MoolenaarOBJ  := gvimext.o
58f4b8e57fSBram Moolenaar
59f4b8e57fSBram MoolenaarDLL  := gvimext.dll
60f4b8e57fSBram Moolenaar
61f4b8e57fSBram Moolenaar.PHONY: all all-before all-after clean clean-custom
62f4b8e57fSBram Moolenaar
63f4b8e57fSBram Moolenaarall: all-before $(DLL) all-after
64f4b8e57fSBram Moolenaar
65f4b8e57fSBram Moolenaar$(DLL): $(OBJ) $(RES) $(DEFFILE)
66b0d3f878SBram Moolenaar	$(CXX) $(LDFLAGS) $(CXXFLAGS) -s -o $@ \
67f4b8e57fSBram Moolenaar		-Wl,--enable-auto-image-base \
68f4b8e57fSBram Moolenaar		-Wl,--enable-auto-import \
69f4b8e57fSBram Moolenaar		-Wl,--whole-archive \
70f4b8e57fSBram Moolenaar			$^ \
71f4b8e57fSBram Moolenaar		-Wl,--no-whole-archive \
72f4b8e57fSBram Moolenaar			$(LIBS)
73f4b8e57fSBram Moolenaar
74f4b8e57fSBram Moolenaargvimext.o: gvimext.cpp
7547cff3a4SBram Moolenaar	$(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -c $? -o $@
76f4b8e57fSBram Moolenaar
77f4b8e57fSBram Moolenaar$(RES): gvimext_ming.rc
78b0d3f878SBram Moolenaar	$(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@
79f4b8e57fSBram Moolenaar
80f4b8e57fSBram Moolenaarclean: clean-custom
81a40c500aSBram Moolenaar	-$(DEL)  $(OBJ) $(RES) $(DLL)
82