Mercurial > hg > syntilista
annotate Makefile.gen @ 208:e6a2658ae096
Enable building via clang++ (tested with 5.0).
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 17 Nov 2017 04:12:38 +0200 |
parents | dfe5e8d7c58a |
children | 131463be208b |
rev | line source |
---|---|
50 | 1 ### |
2 ### Main build file | |
3 ### | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 |
184
87dfca9f704d
Move optimization and warning CFLAGS and CXXFLAGS to Makefile.gen
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
5 CFLAGS += -O2 -W -Wall -Wextra |
208
e6a2658ae096
Enable building via clang++ (tested with 5.0).
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
6 CXXFLAGS += -O2 -W -Wall -Wextra -std=c++11 |
184
87dfca9f704d
Move optimization and warning CFLAGS and CXXFLAGS to Makefile.gen
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
7 |
50 | 8 # Tools |
208
e6a2658ae096
Enable building via clang++ (tested with 5.0).
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
9 ifneq ($(BINTOOL_PREFIX),) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 CC = $(BINTOOL_PREFIX)gcc |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 CXX = $(BINTOOL_PREFIX)g++ |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 AR = $(BINTOOL_PREFIX)ar |
208
e6a2658ae096
Enable building via clang++ (tested with 5.0).
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
13 endif |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 RANLIB = $(BINTOOL_PREFIX)ranlib |
49 | 15 WINDRES = $(BINTOOL_PREFIX)windres |
16 | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 INSTALL ?= install |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 MKDIR ?= mkdir |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
19 MKDIR_P ?= $(MKDIR) -p |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 |
50 | 21 # Common defines |
22 DEFINES += -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 |
50 | 24 # Application stuff |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
25 APP_SRC=src/ |
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
26 APP_IMG=img/ |
49 | 27 APP_BIN=$(BINPATH)Syntilista$(EXEEXT) |
157
325e7590f93e
Move most of the printing related code to printing.cpp
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
28 APP_OBJS=main.o printing.o resources.o moc_main.o |
50 | 29 APP_VERSION := $(shell cat VERSION) |
30 comma:= , | |
31 APP_VERSION_COM := $(subst .,$(comma),$(APP_VERSION)) | |
32 CXXFLAGS += -DAPP_VERSION=\"$(APP_VERSION)\" | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 LOGO_SVG ?= kampuscafe4.svg |
192
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
35 LOGO_IMG ?= CafeKampus_logo_FINAL_RGB.png |
52 | 36 ICON_PNGS = icon-64.png icon-48.png icon-32.png icon-16.png |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
38 APP_RESOURCES += $(addprefix $(APP_IMG),logo.png $(ICON_PNGS)) |
56 | 39 |
49 | 40 |
50 | 41 # And target lists |
49 | 42 TARGETS = $(APP_BIN) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
43 NOBUILD_TARGETS += $(OBJPATH) $(BINPATH) |
81
810ca71af506
Improve 'clean' target handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
44 NOINST_TARGETS += |
810ca71af506
Improve 'clean' target handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
45 CLEAN_TARGETS += icon.ico $(APP_SRC)moc_*.cpp $(APP_SRC)ui_*.h |
810ca71af506
Improve 'clean' target handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
46 DISTCLEAN_TARGETS += |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
48 |
50 | 49 ### |
50 ### Target rules | |
51 ### | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 all: $(NOBUILD_TARGETS) $(NOINST_TARGETS) $(TARGETS) |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 |
50 | 55 moc_predefs.h: |
56 @echo "" > $(OBJPATH)dummy.cpp | |
57 @$(CXX) $(CXXFLAGS) -dM -E -o $@ $(OBJPATH)dummy.cpp | |
58 | |
59 moc_%.cpp: %.h $(QT_MOC_RULES) | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
60 @echo " Qt::MOC $@ $<" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 @$(QT_MOC) $(DEFINES) $(QT_MOC_FLAGS) $(INCPATH) $< -o $@ |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
62 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 ui_%.h: %.ui |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
64 @echo " Qt:UIC $@ $<" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
65 @$(QT_UIC) $(QT_UIC_FLAGS) $< -o $@ |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
66 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
68 $(OBJPATH) $(BINPATH): |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
69 @echo " MKDIR $@" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 @$(MKDIR_P) $@ |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
71 |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
72 $(OBJPATH)%.o: $(APP_SRC)%.cpp $(APP_SRC)%.h |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
73 @echo " CXX $@" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
74 @$(CXX) $(CXXFLAGS) $(DEFINES) $(INCPATH) -c -o $@ $< |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
75 |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
76 $(OBJPATH)%.o: $(APP_SRC)%.cpp |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
77 @echo " CXX $@" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
78 @$(CXX) $(CXXFLAGS) $(DEFINES) $(INCPATH) -c -o $@ $< |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
79 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
80 |
49 | 81 |
50 | 82 ### |
83 ### Windows specific rules | |
84 ### | |
56 | 85 %.rc: %.rc.in icon.ico VERSION |
50 | 86 @sed -e "s/@APP_VERSION@/$(APP_VERSION)/g;s/@APP_VERSION_COM@/$(APP_VERSION_COM)/g;s#@APP_EXE@#$(notdir $(APP_BIN))#g" < $< > $@ |
49 | 87 |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
88 $(OBJPATH)%.o: $(APP_SRC)%.rc |
50 | 89 @echo " WINDRES $<" |
90 @$(WINDRES) $< -O coff -o $@ | |
49 | 91 |
92 | |
93 ### | |
94 ### Application rules | |
95 ### | |
192
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
96 #$(APP_IMG)icon-%.png: $(addprefix $(APP_IMG),$(LOGO_SVG)) |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
97 # inkscape --export-area-page -w $(patsubst $(APP_IMG)icon-%.png,%,$@) -h $(patsubst $(APP_IMG)icon-%.png,%,$@) -e "$@" "$<" |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
98 |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
99 #$(APP_IMG)logo.png: $(addprefix $(APP_IMG),$(LOGO_SVG)) |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
100 # inkscape --export-area-page -w 258 -h 220 -e "$@" "$<" |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
101 |
192
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
102 $(APP_IMG)icon-%.png: $(addprefix $(APP_IMG),$(LOGO_IMG)) |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
103 convert "$<" -scale "$(patsubst $(APP_IMG)icon-%.png,%,$@)x$(patsubst $(APP_IMG)icon-%.png,%,$@)" "$@" |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
104 |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
105 $(APP_IMG)logo.png: $(addprefix $(APP_IMG),$(LOGO_IMG)) |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
106 convert "$<" -scale "258x220" "$@" |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
107 |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
108 icon.ico: $(addprefix $(APP_IMG),$(ICON_PNGS)) |
52 | 109 @echo " CONVERT $+ -> $@" |
110 @convert $+ $@ | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
111 |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
112 $(APP_SRC)%.cpp: $(APP_SRC)%.qrc $(APP_RESOURCES) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
113 @echo " Qt:RCC $@ $<" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
114 @$(QT_RCC) -name "Syntilista" $< -o $@ |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
115 |
90
efab68769c75
Implement new separate About dialog/help window.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
116 $(OBJPATH)main.o: $(addprefix $(APP_SRC),main.cpp main.h ui_mainwindow.h ui_editperson.h ui_aboutwindow.h) VERSION |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
117 @echo " CXX $@" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
118 @$(CXX) $(CXXFLAGS) $(DEFINES) $(INCPATH) -c -o $@ $< |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 |
52 | 121 $(APP_BIN): $(addprefix $(OBJPATH),$(APP_OBJS)) $(APP_DEP_LIBS) | $(APP_DEPS) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
122 @echo " LINK $@" |
52 | 123 @$(CXX) $(LDFLAGS) -o $@ $+ $(APP_LIBS) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
124 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
125 |
50 | 126 ### |
127 ### Special targets | |
128 ### | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
129 clean: |
81
810ca71af506
Improve 'clean' target handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
130 -$(RM) $(TARGETS) $(NOINST_TARGETS) $(CLEAN_TARGETS) $(OBJPATH)*.o |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
131 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 distclean: clean |
52 | 133 -$(RM) $(DISTCLEAN_TARGETS) *~ core *.core |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
134 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
135 .PHONY: clean distclean all |