OPT added to MAkefile; KanjiView::Cell constructor: fg,bg changed to int (Fl_Color...
[aoi.git] / Makefile
bloba47987cf3f881906479b6de37646c1e63bfb9a84
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 -g -ggdb3
13 WARNINGS = -Wall -Wno-vla -Wno-long-long -pedantic
15 OPT = -O2
16 LIBS = -L/usr/local/lib -L/lib
17 INCLUDE = -I/include
18 CURL_CFLAGS = $(shell curl-config --cflags)
19 CURL_LIBS = $(shell curl-config --libs)
20 CURL_STATICLIBS = $(shell curl-config --libs)
21 FLTK_CXXFLAGS = $(shell fltk-config --cxxflags)
22 FLTK_LIBS = $(shell fltk-config --use-images --ldflags --libs)
23 FLTK_STATICLIBS = $(shell fltk-config --use-images --ldstaticflags --libs)
25 CFLAGS = ${WARNINGS}
26 CXXFLAGS = ${CURL_CFLAGS} ${INCLUDE} -std=c++11 ${WARNINGS} ${FLTK_CXXFLAGS}
27 LDFLAGS = ${LIBS} ${FLTK_LIBS} ${FLTK_LIBS} -lstdc++ -lz ${CURL_LIBS}
28 LDSTATICFLAGS = ${LIBS} ${FLTK_STATICLIBS} ${CURL_STATICLIBS} -static-libgcc -static-libstdc++
30 NAME = aoi
32 # OS specific settings
33 ifeq ($(shell uname), Linux)
34 else # Windows
35 NAME=aoi.exe
36 CXX=g++ -DWINDOWS
37 CC=gcc
38 # -mwindows: dont use console for stdout/stderr
39 # -mconsole
40 LDFLAGS=${LDSTATICFLAGS} -mwindows
41 endif
44 OBJ=\
45 src/3rdparty/sqlite3.o\
46 src/config.o\
47 src/romanization.o\
48 src/aoi.o\
49 src/utils.o\
50 src/parsers.o\
51 src/main.o\
52 src/gui.o\
53 src/gui_widgets.o\
54 src/gui_dialogs.o\
55 src/gui_dicview.o\
56 src/gui_kanjiview.o
58 SRC=\
59 src/3rdparty/sqlite3.c\
60 src/config.cxx\
61 src/romanization.cxx\
62 src/aoi.cxx\
63 src/utils.cxx\
64 src/parsers.cxx\
65 src/main.cxx\
66 src/gui.cxx\
67 src/gui_widgets.cxx\
68 src/gui_dialogs.cxx\
69 src/gui_dicview.cxx\
70 src/gui_kanjiview.cxx
72 HEAD=\
73 src/3rdparty/sqlite3.h\
74 src/3rdparty/sqlite3ext.h\
75 src/3rdparty/rapidxml.hpp\
76 src/logger.hxx\
77 src/sqlite3.hxx\
78 src/config.hxx\
79 src/datatypes.hxx\
80 src/romanization.hxx\
81 src/utils.hxx\
82 src/parsers.hxx\
83 src/aoi.hxx\
84 src/gui_settings.hxx\
85 src/gui_widgets.hxx\
86 src/gui_dialogs.hxx\
87 src/gui.hxx\
88 src/gui_dicview.hxx\
89 src/gui_kanjiview.hxx
91 .PHONY: build
92 .PHONY: debug
93 .PHONY: distro
94 .PHONY: clean
96 build: ${NAME}
98 debug: OPT=-00
99 debug: CXXFLAGS += ${DEBUG}
100 ifneq ($(shell uname),Linux) # show console in Windows
101 debug: LDFLAGS += -mconsole
102 endif
103 debug: build
105 %.o: %.c
106 ${CC} ${CFLAGS} ${OPT} -c $< -o $@
108 %.o: %.cxx
109 ${CXX} ${CXXFLAGS} ${OPT} -c $< -o $@
111 ${NAME}: ${OBJ}
112 ${CXX} ${CXXFLAGS} ${OPT} ${OBJ} -o ${NAME} ${LDFLAGS}
114 clean:
115 rm -f src/*.o src/3rdparty/*.o src/gui/*.o ${NAME} 2>/dev/null
117 ${OBJ}: ${HEAD}
119 distro: clean build
120 strip -s ${NAME}