10
|
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
|
2674
|
20 # Link against the shared versions of libgcc/libstdc++ by default. Set
|
|
21 # STATIC_STDCPLUS to "yes" to link against static versions instead.
|
|
22 STATIC_STDCPLUS=no
|
|
23 #STATIC_STDCPLUS=yes
|
|
24
|
|
25 # Note: -static-libstdc++ is not available until gcc 4.5.x.
|
|
26 LDFLAGS += -shared
|
|
27 ifeq (yes, $(STATIC_STDCPLUS))
|
|
28 LDFLAGS += -static-libgcc -static-libstdc++
|
|
29 endif
|
|
30
|
10
|
31 ifeq ($(CROSS),yes)
|
89
|
32 DEL = rm
|
10
|
33 ifeq ($(MINGWOLD),yes)
|
|
34 CXXFLAGS := -O2 -mno-cygwin -fvtable-thunks
|
|
35 else
|
|
36 CXXFLAGS := -O2 -mno-cygwin
|
|
37 endif
|
|
38 else
|
|
39 CXXFLAGS := -O2 -mno-cygwin
|
89
|
40 ifneq (sh.exe, $(SHELL))
|
|
41 DEL = rm
|
|
42 else
|
|
43 DEL = del
|
|
44 endif
|
10
|
45 endif
|
2088
|
46 CXX := $(CROSS_COMPILE)g++
|
2674
|
47 WINDRES := $(CROSS_COMPILE)windres
|
|
48 WINDRES_CXX = $(CXX)
|
|
49 WINDRES_FLAGS = --preprocessor="$(WINDRES_CXX) -E -xc" -DRC_INVOKED
|
10
|
50 LIBS := -luuid
|
|
51 RES := gvimext.res
|
|
52 DEFFILE = gvimext_ming.def
|
|
53 OBJ := gvimext.o
|
|
54
|
|
55 DLL := gvimext.dll
|
|
56
|
|
57 .PHONY: all all-before all-after clean clean-custom
|
|
58
|
|
59 all: all-before $(DLL) all-after
|
|
60
|
|
61 $(DLL): $(OBJ) $(RES) $(DEFFILE)
|
2674
|
62 $(CXX) $(LDFLAGS) $(CXXFLAGS) -s -o $@ \
|
10
|
63 -Wl,--enable-auto-image-base \
|
|
64 -Wl,--enable-auto-import \
|
|
65 -Wl,--whole-archive \
|
|
66 $^ \
|
|
67 -Wl,--no-whole-archive \
|
|
68 $(LIBS)
|
|
69
|
|
70 gvimext.o: gvimext.cpp
|
|
71 $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@
|
|
72
|
|
73 $(RES): gvimext_ming.rc
|
2674
|
74 $(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@
|
10
|
75
|
|
76 clean: clean-custom
|
89
|
77 -$(DEL) $(OBJ) $(RES) $(DLL)
|
10
|
78
|