Merge pull request #110 from tesselode/fixes
[wdl/wdl-ol.git] / WDL / swell / Makefile
blob2b89a4db238ec3df84071fe4eeca67a23d666a11
1 # use make
2 # or make NOGDK=1
3 # or make DEBUG=1
4 # etc
6 ARCH := $(shell uname -m)
7 UNAME_S := $(shell uname -s)
9 PKG_CONFIG = pkg-config
11 CFLAGS = -pipe -fvisibility=hidden -fno-math-errno -fPIC -DPIC -Wall -Wshadow -Wno-unused-function -Wno-multichar -Wno-unused-result
13 ifeq ($(UNAME_S),Darwin)
14 CFLAGS += -Wno-unused-private-field -DSWELL_FORCE_GENERIC
15 DLL_EXT=.dylib
16 else
17 DLL_EXT=.so
18 endif
20 ifndef ALLOW_WARNINGS
21 CFLAGS += -Werror
22 endif
23 ifndef DEPRECATED_WARNINGS
24 CFLAGS += -Wno-deprecated-declarations
25 endif
27 ifneq ($(filter arm%,$(ARCH)),)
28 CFLAGS += -fsigned-char -marm
29 endif
32 ifdef DEBUG
33 CFLAGS += -O0 -g -D_DEBUG
34 else
35 CFLAGS += -O2 -DNDEBUG
36 ifneq ($(UNAME_S),Darwin)
37 CFLAGS += -s
38 endif
39 endif
41 LINKEXTRA = -lpthread -ldl
44 EXTRA_OBJS =
49 vpath %.cpp .. ../lice
51 SWELL_OBJS = swell.o swell-ini.o swell-miscdlg-generic.o swell-wnd-generic.o \
52 swell-menu-generic.o swell-kb-generic.o swell-dlg-generic.o \
53 swell-gdi-generic.o swell-misc-generic.o swell-gdi-lice.o \
54 swell-generic-headless.o swell-generic-gdk.o \
55 swell-appstub-generic.o swell-modstub-generic.o
57 LICE_OBJS = lice.o lice_arc.o lice_colorspace.o lice_line.o lice_text.o \
58 lice_textnew.o lice_ico.o lice_bmp.o
60 OBJS = $(SWELL_OBJS)
62 ifndef NOGDK
63 ifdef GDK2
64 CFLAGS += -DSWELL_TARGET_GDK=2 $(shell $(PKG_CONFIG) --cflags gdk-2.0)
65 ifndef PRELOAD_GDK
66 LINKEXTRA += $(shell $(PKG_CONFIG) --libs gdk-2.0)
67 else
68 LINKEXTRA += -lX11 -lXi
69 CFLAGS += -DSWELL_PRELOAD="libgdk-x11-2.0.so.0"
70 endif
71 else
72 ifdef SWELL_SUPPORT_GTK
73 CFLAGS += -DSWELL_TARGET_GDK=3 $(shell $(PKG_CONFIG) --cflags gtk+-3.0) -DSWELL_SUPPORT_GTK
74 else
75 CFLAGS += -DSWELL_TARGET_GDK=3 $(shell $(PKG_CONFIG) --cflags gdk-3.0)
76 endif
77 ifndef PRELOAD_GDK
78 ifdef SWELL_SUPPORT_GTK
79 LINKEXTRA += $(shell $(PKG_CONFIG) --libs gtk+-3.0)
80 else
81 LINKEXTRA += $(shell $(PKG_CONFIG) --libs gdk-3.0)
82 endif
83 else
84 LINKEXTRA += -lX11 -lXi
85 ifdef SWELL_SUPPORT_GTK
86 CFLAGS += -DSWELL_PRELOAD="libgtk+-3.so.0"
87 else
88 CFLAGS += -DSWELL_PRELOAD="libgdk-3.so.0"
89 endif
90 endif
91 endif
92 CFLAGS += -DSWELL_LICE_GDI
93 OBJS += $(LICE_OBJS)
95 ifndef NOFREETYPE
96 CFLAGS += -DSWELL_FREETYPE $(shell freetype-config --cflags)
97 ifndef PRELOAD_GDK
98 LINKEXTRA += $(shell freetype-config --libs)
99 endif
100 endif
101 endif
103 CXXFLAGS = $(CFLAGS)
105 default: libSwell$(DLL_EXT)
107 .PHONY: clean
109 SWELL_HEADERS=swell-dlggen.h swell-gdi-internalpool.h swell-menugen.h swell-types.h swell-functions.h swell-internal.h
111 swell.o: $(SWELL_HEADERS)
112 swell-ini.o: $(SWELL_HEADERS)
113 swell-wnd-generic.o: $(SWELL_HEADERS)
114 swell-dlg-generic.o: $(SWELL_HEADERS)
115 swell-menu-generic.o: $(SWELL_HEADERS)
116 swell-misc-generic.o: $(SWELL_HEADERS)
117 swell-gdi-generic.o: $(SWELL_HEADERS)
118 swell-gdi-lice.o: $(SWELL_HEADERS)
119 swell-kb-generic.o: $(SWELL_HEADERS)
120 swell-miscdlg-generic.o: $(SWELL_HEADERS)
121 swell-modstub-generic.o: $(SWELL_HEADERS)
122 swell-appstub-generic.o: $(SWELL_HEADERS)
124 libSwell$(DLL_EXT): $(OBJS)
125 $(CXX) -shared -o $@ $(CFLAGS) $(LFLAGS) $^ $(LINKEXTRA)
127 test: $(OBJS) test.o
128 $(CXX) -o test $(CFLAGS) $(LFLAGS) $^ $(LINKEXTRA)
130 libSwell.colortheme: swell-gdi-generic.cpp $(SWELL_HEADERS)
131 $(CXX) $(CFLAGS) -o make-theme -DSWELL__MAKE_THEME swell-gdi-generic.cpp -lpthread
132 ./make-theme > libSwell.colortheme
134 clean:
135 -rm $(OBJS) libSwell$(DLL_EXT) make-theme libSwell.colortheme