Mercurial > hg > syntilista
annotate Makefile.gen @ 259:14ed3a2500e6
Fix build.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 24 Dec 2019 05:14:48 +0200 |
parents | daaad6ad8212 |
children | 847917a62ea2 |
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 |
234 | 22 DEFINES += -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG \ |
23 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB \ | |
24 -DQT_CORE_LIB | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 |
50 | 26 # Application stuff |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
27 APP_IMG=img/ |
49 | 28 APP_BIN=$(BINPATH)Syntilista$(EXEEXT) |
233 | 29 |
30 APP_HDRS=\ | |
31 src/main.h \ | |
246
43a5e09bb832
Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
242
diff
changeset
|
32 src/util.h \ |
233 | 33 src/ui_viewtransactions.h \ |
34 src/ui_mainwindow.h \ | |
35 src/ui_editperson.h \ | |
36 src/ui_aboutwindow.h | |
37 | |
237
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
38 APP_OBJS=\ |
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
39 main.o \ |
246
43a5e09bb832
Split some utility functions to util.{h,cpp}
Matti Hamalainen <ccr@tnsp.org>
parents:
242
diff
changeset
|
40 util.o \ |
237
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
41 editperson.o \ |
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
42 viewtransactions.o \ |
242
3d3ba5759cac
Move about-window code to separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
238
diff
changeset
|
43 aboutwindow.o \ |
237
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
44 sqlmodels.o \ |
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
45 printing.o \ |
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
46 resources.o \ |
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
47 moc_main.o \ |
54ab3f3e28c0
Split EditPerson and ViewTransactions to separate source files.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
48 runguard.o |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
49 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 LOGO_SVG ?= kampuscafe4.svg |
192
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
51 LOGO_IMG ?= CafeKampus_logo_FINAL_RGB.png |
52 | 52 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
|
53 |
231
e90dba0cd12a
Implement HTML stuff for about dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
54 APP_RESOURCES += $(addprefix $(APP_IMG),logo.png $(ICON_PNGS)) COPYING.html |
56 | 55 |
50 | 56 # And target lists |
49 | 57 TARGETS = $(APP_BIN) |
258 | 58 NOBUILD_TARGETS += |
81
810ca71af506
Improve 'clean' target handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
59 NOINST_TARGETS += |
233 | 60 CLEAN_TARGETS += icon.ico src/moc_*.cpp src/ui_*.h |
81
810ca71af506
Improve 'clean' target handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
61 DISTCLEAN_TARGETS += |
48
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 |
233 | 64 # Version |
65 APP_VERSION := $(shell cat VERSION) | |
66 comma:= , | |
67 APP_VERSION_COM := $(subst .,$(comma),$(APP_VERSION)) | |
68 CXXFLAGS += -DAPP_VERSION=\"$(APP_VERSION)\" | |
69 | |
70 | |
258 | 71 ifneq ($(V),1) |
72 COMPILE_C_OBJ = @if test ! -d $(OBJPATH); then $(MKDIR_P) $(OBJPATH); fi && echo " CC $<" && $(CC) $(CFLAGS) -c -o $@ $< | |
73 COMPILE_CXX_OBJ = @if test ! -d $(OBJPATH); then $(MKDIR_P) $(OBJPATH); fi && echo " CXX $<" && $(CXX) $(CXXFLAGS) -c -o $@ $< | |
74 LINK_C_BIN = @if test ! -d $(BINPATH); then $(MKDIR_P) $(BINPATH); fi && echo " LINK $@" && $(CC) -o $@ $(filter %.o %.a,$+) | |
75 LINK_CXX_BIN = @if test ! -d $(BINPATH); then $(MKDIR_P) $(BINPATH); fi && echo " LINK $@" && $(CXX) -o $@ $(filter %.o %.a,$+) | |
76 LINK_STATIC_LIB = @echo " AR $@" && $(AR) cru $@ $(filter %.o,$+) && $(RANLIB) $@ | |
77 else | |
78 COMPILE_C_OBJ = @if test ! -d $(OBJPATH); then $(MKDIR_P) $(OBJPATH); fi && echo "$(CC) $(CFLAGS) -c -o $@ $<" && $(CC) $(CFLAGS) -c -o $@ $< | |
79 COMPILE_CXX_OBJ = @if test ! -d $(OBJPATH); then $(MKDIR_P) $(OBJPATH); fi && echo "$(CXX) $(CXXFLAGS) -c -o $@ $<" && $(CXX) $(CXXFLAGS) -c -o $@ $< | |
80 LINK_C_BIN = @if test ! -d $(BINPATH); then $(MKDIR_P) $(BINPATH); fi && echo "$(CC) -o $@ $(filter %.o %.a,$+)" && $(CC) -o $@ $(filter %.o %.a,$+) | |
81 LINK_CXX_BIN = @if test ! -d $(BINPATH); then $(MKDIR_P) $(BINPATH); fi && echo "$(CXX) -o $@ $(filter %.o %.a,$+)" && $(CXX) -o $@ $(filter %.o %.a,$+) | |
82 LINK_STATIC_LIB = @echo "$(AR) cru $@ $(filter %.o,$+)" && $(AR) cru $@ $(filter %.o,$+) && echo "$(RANLIB) $@" && $(RANLIB) $@ | |
83 endif | |
84 | |
85 | |
50 | 86 ### |
87 ### Target rules | |
88 ### | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
89 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
|
90 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
91 |
50 | 92 moc_predefs.h: |
93 @echo "" > $(OBJPATH)dummy.cpp | |
94 @$(CXX) $(CXXFLAGS) -dM -E -o $@ $(OBJPATH)dummy.cpp | |
95 | |
96 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
|
97 @echo " Qt::MOC $@ $<" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
98 @$(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
|
99 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 ui_%.h: %.ui |
238 | 101 @echo " Qt::UIC $@ $<" |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
102 @$(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
|
103 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
104 |
233 | 105 $(OBJPATH)%.o: src/%.cpp src/%.h |
258 | 106 $(COMPILE_CXX_OBJ) $(DEFINES) $(INCPATH) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
107 |
233 | 108 $(OBJPATH)%.o: src/%.cpp |
258 | 109 $(COMPILE_CXX_OBJ) $(DEFINES) $(INCPATH) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
110 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
111 |
49 | 112 |
50 | 113 ### |
114 ### Windows specific rules | |
115 ### | |
56 | 116 %.rc: %.rc.in icon.ico VERSION |
50 | 117 @sed -e "s/@APP_VERSION@/$(APP_VERSION)/g;s/@APP_VERSION_COM@/$(APP_VERSION_COM)/g;s#@APP_EXE@#$(notdir $(APP_BIN))#g" < $< > $@ |
49 | 118 |
233 | 119 $(OBJPATH)%.o: src/%.rc |
50 | 120 @echo " WINDRES $<" |
121 @$(WINDRES) $< -O coff -o $@ | |
49 | 122 |
123 | |
124 ### | |
125 ### Application rules | |
126 ### | |
192
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
127 #$(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
|
128 # 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
|
129 |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
130 #$(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
|
131 # 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
|
132 |
192
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
133 $(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
|
134 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
|
135 |
dfe5e8d7c58a
Use the finalized Cafe Kampus logo.
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
136 $(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
|
137 convert "$<" -scale "258x220" "$@" |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
138 |
80
c8fd927cd2c4
Restructure the project by placing source code, images into appropriate
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
139 icon.ico: $(addprefix $(APP_IMG),$(ICON_PNGS)) |
52 | 140 @echo " CONVERT $+ -> $@" |
141 @convert $+ $@ | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
142 |
233 | 143 src/%.cpp: src/%.qrc $(APP_RESOURCES) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
144 @echo " Qt:RCC $@ $<" |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
145 @$(QT_RCC) -name "Syntilista" $< -o $@ |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
146 |
233 | 147 $(OBJPATH)main.o: src/main.cpp $(APP_HDRS) VERSION |
258 | 148 $(COMPILE_CXX_OBJ) $(DEFINES) $(INCPATH) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
149 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
150 |
52 | 151 $(APP_BIN): $(addprefix $(OBJPATH),$(APP_OBJS)) $(APP_DEP_LIBS) | $(APP_DEPS) |
259 | 152 $(LINK_CXX_BIN) $(APP_LIBS) |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
153 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
154 |
50 | 155 ### |
156 ### Special targets | |
157 ### | |
48
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
158 clean: |
81
810ca71af506
Improve 'clean' target handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
159 -$(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
|
160 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
161 distclean: clean |
52 | 162 -$(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
|
163 |
200ec310660a
Begin revamp of the buildsystem, don't use qmake anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
164 .PHONY: clean distclean all |