xref: /vim-8.2.3635/src/GvimExt/Make_ming.mak (revision f233048a)
1# Project: gvimext
2# Generates gvimext.dll with gcc.
3# Can be used for Cygwin and MingW (MingW ignores -mno-cygwin)
4#
5# Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000
6# Now it is allocated dymanically by the linker by evaluating all DLLs
7# already loaded in memory. The binary image contains as well information
8# for automatic pseudo-rebasing, if needed by the system. ALV 2004-02-29
9
10# If cross-compiling set this to yes, else set it to no
11CROSS = no
12#CROSS = yes
13# For the old MinGW 2.95 (the one you get e.g. with debian woody)
14# set the following variable to yes and check if the executables are
15# really named that way.
16# If you have a newer MinGW or you are using cygwin set it to no and
17# check also the executables
18MINGWOLD = no
19
20ifeq ($(CROSS),yes)
21DEL = rm
22ifeq ($(MINGWOLD),yes)
23CXX = i586-mingw32msvc-g++
24CXXFLAGS := -O2 -mno-cygwin -fvtable-thunks
25WINDRES = i586-mingw32msvc-windres
26else
27CXX = i386-mingw32msvc-g++
28CXXFLAGS := -O2 -mno-cygwin
29WINDRES = i386-mingw32msvc-windres
30endif
31else
32CXX := g++
33WINDRES := windres
34CXXFLAGS := -O2 -mno-cygwin
35ifneq (sh.exe, $(SHELL))
36DEL = rm
37else
38DEL = del
39endif
40endif
41LIBS :=  -luuid
42RES  := gvimext.res
43DEFFILE = gvimext_ming.def
44OBJ  := gvimext.o
45
46DLL  := gvimext.dll
47
48.PHONY: all all-before all-after clean clean-custom
49
50all: all-before $(DLL) all-after
51
52$(DLL): $(OBJ) $(RES) $(DEFFILE)
53	$(CXX) -shared $(CXXFLAGS) -s -o $@ \
54		-Wl,--enable-auto-image-base \
55		-Wl,--enable-auto-import \
56		-Wl,--whole-archive \
57			$^ \
58		-Wl,--no-whole-archive \
59			$(LIBS)
60
61gvimext.o: gvimext.cpp
62	$(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@
63
64$(RES): gvimext_ming.rc
65	$(WINDRES) --input-format=rc --output-format=coff -DMING $? -o $@
66
67clean: clean-custom
68	-$(DEL)  $(OBJ) $(RES) $(DLL)
69
70