some valgrind indiced changes
[aoi.git] / Makefile
blobf0bca03af532d04cde9fec258889609b3e6c4308
1 # This Makefile should work under Linux and Mingw32 (in Windows)
3 # Requires C++11 and C99 (only variable length arrays)) compatible compiler
4 # (tested with gcc 4.7, clang 3.2)
6 # http://tehsausage.com/mingw-to-string
8 # CLANG does not have -ggdb3
10 CXX = clang
11 CC = $(CXX)
12 DEBUG = -DDEBUG -O0 -g -ggdb3
13 WARNINGS = -Wall -Wno-vla -Wno-long-long -pedantic
15 LIBS = -L/usr/local/lib -L/lib
16 INCLUDE = -I/include
17 CURL_CFLAGS = $(shell curl-config --cflags)
18 CURL_LIBS = $(shell curl-config --libs)
19 CURL_STATICLIBS = $(shell curl-config --libs)
20 FLTK_CXXFLAGS = $(shell fltk-config --cxxflags)
21 FLTK_LIBS = $(shell fltk-config --use-images --ldflags --libs)
22 FLTK_STATICLIBS = $(shell fltk-config --use-images --ldstaticflags --libs)
24 CFLAGS = ${WARNINGS}
25 CXXFLAGS = ${CURL_CFLAGS} ${INCLUDE} -std=c++11 ${WARNINGS} ${FLTK_CXXFLAGS}
26 LDFLAGS = ${LIBS} ${FLTK_LIBS} ${FLTK_LIBS} -lstdc++ -lz ${CURL_LIBS}
27 LDSTATICFLAGS = ${LIBS} ${FLTK_STATICLIBS} ${CURL_STATICLIBS} -static-libgcc -static-libstdc++
29 NAME = aoi
31 # OS specific settings
32 ifeq ($(shell uname), Linux)
33 else # Windows
34 NAME=aoi.exe
35 CXX=g++ -DWINDOWS
36 CC=gcc
37 # -mwindows: dont use console for stdout/stderr
38 # -mconsole
39 LDFLAGS=${LDSTATICFLAGS} -mwindows
40 endif
43 OBJ=\
44 src/3rdparty/sqlite3.o\
45 src/config.o\
46 src/romanization.o\
47 src/aoi.o\
48 src/utils.o\
49 src/parsers.o\
50 src/main.o\
51 src/gui.o\
52 src/gui_widgets.o\
53 src/gui_dialogs.o\
54 src/gui_dicview.o\
55 src/gui_kanjiview.o
57 SRC=\
58 src/3rdparty/sqlite3.c\
59 src/config.cxx\
60 src/romanization.cxx\
61 src/aoi.cxx\
62 src/utils.cxx\
63 src/parsers.cxx\
64 src/main.cxx\
65 src/gui.cxx\
66 src/gui_widgets.cxx\
67 src/gui_dialogs.cxx\
68 src/gui_dicview.cxx\
69 src/gui_kanjiview.cxx
71 HEAD=\
72 src/3rdparty/sqlite3.h\
73 src/3rdparty/sqlite3ext.h\
74 src/3rdparty/rapidxml.hpp\
75 src/logger.hxx\
76 src/sqlite3.hxx\
77 src/config.hxx\
78 src/datatypes.hxx\
79 src/romanization.hxx\
80 src/utils.hxx\
81 src/parsers.hxx\
82 src/aoi.hxx\
83 src/gui_settings.hxx\
84 src/gui_widgets.hxx\
85 src/gui_dialogs.hxx\
86 src/gui.hxx\
87 src/gui_dicview.hxx\
88 src/gui_kanjiview.hxx
90 .PHONY: build
91 .PHONY: debug
92 .PHONY: distro
93 .PHONY: clean
95 build: ${NAME}
97 debug: CXXFLAGS += ${DEBUG}
98 ifneq ($(shell uname),Linux) # show console in Windows
99 debug: LDFLAGS += -mconsole
100 endif
101 debug: build
103 %.o: %.c
104 ${CC} ${CFLAGS} -c $< -o $@
106 %.o: %.cxx
107 ${CXX} ${CXXFLAGS} -c $< -o $@
109 ${NAME}: ${OBJ}
110 ${CXX} ${CXXFLAGS} ${OBJ} -o ${NAME} ${LDFLAGS}
112 clean:
113 rm -f src/*.o src/3rdparty/*.o src/gui/*.o ${NAME} 2>/dev/null
115 ${OBJ}: ${HEAD}
117 distro: clean build
118 strip -s ${NAME}