blob: 5997e7ed912d53d42153ebb323453fd9743a2da3 [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)
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000023CXXFLAGS := -O2 -mno-cygwin -fvtable-thunks
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000024else
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000025CXXFLAGS := -O2 -mno-cygwin
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000026endif
27else
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000028CXXFLAGS := -O2 -mno-cygwin
Bram Moolenaara40c5002005-01-09 21:16:21 +000029ifneq (sh.exe, $(SHELL))
30DEL = rm
31else
32DEL = del
33endif
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000034endif
Bram Moolenaar48f80c22010-02-24 15:08:27 +010035CXX := $(CROSS_COMPILE)g++
36WINDRES := $(CROSS_COMPILE)windres
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000037LIBS := -luuid
38RES := gvimext.res
39DEFFILE = gvimext_ming.def
40OBJ := gvimext.o
41
42DLL := gvimext.dll
43
44.PHONY: all all-before all-after clean clean-custom
45
46all: all-before $(DLL) all-after
47
48$(DLL): $(OBJ) $(RES) $(DEFFILE)
49 $(CXX) -shared $(CXXFLAGS) -s -o $@ \
50 -Wl,--enable-auto-image-base \
51 -Wl,--enable-auto-import \
52 -Wl,--whole-archive \
53 $^ \
54 -Wl,--no-whole-archive \
55 $(LIBS)
56
57gvimext.o: gvimext.cpp
58 $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@
59
60$(RES): gvimext_ming.rc
61 $(WINDRES) --input-format=rc --output-format=coff -DMING $? -o $@
62
63clean: clean-custom
Bram Moolenaara40c5002005-01-09 21:16:21 +000064 -$(DEL) $(OBJ) $(RES) $(DLL)
Bram Moolenaarf4b8e572004-06-24 15:53:16 +000065