blob: f10f730109a1b21fdf8b2064c179f2b9aba70b5f [file] [log] [blame]
Bram Moolenaarf4b8e572004-06-24 15:53:16 +00001# 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)
Bram Moolenaara40c5002005-01-09 21:16:21 +000021DEL = rm
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000022ifeq ($(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
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000032CXX := g++
33WINDRES := windres
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000034CXXFLAGS := -O2 -mno-cygwin
Bram Moolenaara40c5002005-01-09 21:16:21 +000035ifneq (sh.exe, $(SHELL))
36DEL = rm
37else
38DEL = del
39endif
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000040endif
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
Bram Moolenaara40c5002005-01-09 21:16:21 +000068 -$(DEL) $(OBJ) $(RES) $(DLL)
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000069