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) |
| 21 | ifeq ($(MINGWOLD),yes) |
| 22 | CXX = i586-mingw32msvc-g++ |
| 23 | CXXFLAGS := -O2 -mno-cygwin -fvtable-thunks |
| 24 | WINDRES = i586-mingw32msvc-windres |
| 25 | else |
| 26 | CXX = i386-mingw32msvc-g++ |
| 27 | CXXFLAGS := -O2 -mno-cygwin |
| 28 | WINDRES = i386-mingw32msvc-windres |
| 29 | endif |
| 30 | else |
| 31 | CXX := g++.exe |
| 32 | WINDRES := windres.exe |
| 33 | CXXFLAGS := -O2 -mno-cygwin |
| 34 | endif |
| 35 | LIBS := -luuid |
| 36 | RES := gvimext.res |
| 37 | DEFFILE = gvimext_ming.def |
| 38 | OBJ := gvimext.o |
| 39 | |
| 40 | DLL := gvimext.dll |
| 41 | |
| 42 | .PHONY: all all-before all-after clean clean-custom |
| 43 | |
| 44 | all: all-before $(DLL) all-after |
| 45 | |
| 46 | $(DLL): $(OBJ) $(RES) $(DEFFILE) |
| 47 | $(CXX) -shared $(CXXFLAGS) -s -o $@ \ |
| 48 | -Wl,--enable-auto-image-base \ |
| 49 | -Wl,--enable-auto-import \ |
| 50 | -Wl,--whole-archive \ |
| 51 | $^ \ |
| 52 | -Wl,--no-whole-archive \ |
| 53 | $(LIBS) |
| 54 | |
| 55 | gvimext.o: gvimext.cpp |
| 56 | $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@ |
| 57 | |
| 58 | $(RES): gvimext_ming.rc |
| 59 | $(WINDRES) --input-format=rc --output-format=coff -DMING $? -o $@ |
| 60 | |
| 61 | clean: clean-custom |
| 62 | $(RM) $(OBJ) $(RES) $(DLL) |
| 63 | |