Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 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 |
| 11 | CROSS = 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 |
| 18 | MINGWOLD = no |
| 19 | |
| 20 | ifeq ($(CROSS),yes) |
Bram Moolenaar | a40c500 | 2005-01-09 21:16:21 +0000 | [diff] [blame] | 21 | DEL = rm |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 22 | ifeq ($(MINGWOLD),yes) |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 23 | CXXFLAGS := -O2 -mno-cygwin -fvtable-thunks |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 24 | else |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 25 | CXXFLAGS := -O2 -mno-cygwin |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 26 | endif |
| 27 | else |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 28 | CXXFLAGS := -O2 -mno-cygwin |
Bram Moolenaar | a40c500 | 2005-01-09 21:16:21 +0000 | [diff] [blame] | 29 | ifneq (sh.exe, $(SHELL)) |
| 30 | DEL = rm |
| 31 | else |
| 32 | DEL = del |
| 33 | endif |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 34 | endif |
Bram Moolenaar | 48f80c2 | 2010-02-24 15:08:27 +0100 | [diff] [blame] | 35 | CXX := $(CROSS_COMPILE)g++ |
Bram Moolenaar | d622beb | 2010-09-29 18:42:28 +0200 | [diff] [blame] | 36 | WINDRES := $(CROSS_COMPILE)windres --preprocessor="$(CXX) -E -xc" -DRC_INVOKED |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 37 | LIBS := -luuid |
| 38 | RES := gvimext.res |
| 39 | DEFFILE = gvimext_ming.def |
| 40 | OBJ := gvimext.o |
| 41 | |
| 42 | DLL := gvimext.dll |
| 43 | |
| 44 | .PHONY: all all-before all-after clean clean-custom |
| 45 | |
| 46 | all: 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 | |
| 57 | gvimext.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 | |
| 63 | clean: clean-custom |
Bram Moolenaar | a40c500 | 2005-01-09 21:16:21 +0000 | [diff] [blame] | 64 | -$(DEL) $(OBJ) $(RES) $(DLL) |
Bram Moolenaar | f4b8e57 | 2004-06-24 15:53:16 +0000 | [diff] [blame] | 65 | |