-
-
Notifications
You must be signed in to change notification settings - Fork 86
/
Makefile
175 lines (125 loc) · 6.77 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Copyright (c) 2018, Michal Policht. This file is dually licensed under terms of
# either WTFPL or BEER-WARE LICENSE. You may obtain the copy of WTFPL or BEER-WARE
# LICENSE by googling, binging, yahooing or downloading it from pirate bay.
# NO WARRANTY.
first: help
# [help] Help message to be printed.
HELP_MESSAGE =
# [license] Names of files containing license text to be appended to files, commented out with double slash.
LICENSE_DSLASH = 'LICENSE.*.dslash.inc'
# [license] Names of files containing license text to be appended to files, commented out with hash.
LICENSE_HASH = 'LICENSE.*.hash.inc'
# [license] Names of files containing license text to be appended to files, commented out with XML comment.
LICENSE_XML = 'LICENSE.*.xml.inc'
# [license] CMake file types.
CMAKE_FILE_TYPES = -name '*.cmake' -o -name 'CMakeLists.txt'
# [license] Qbs file types.
QBS_FILE_TYPES = -name '*.qbs'
# [license] QML file types.
QML_FILE_TYPES = -name '*.qml'
# [license] JavaScript file types.
JS_FILE_TYPES = -name '*.js'
# [license] XML file types.
XML_FILE_TYPES = -name '*.xml'
# [license] Source file types.
SOURCE_FILE_TYPES = -name '*.cpp' -o -name '*.c' -o -name '*.cpp.in'
# [license, guards] Include file types.
INCLUDE_FILE_TYPES = -name '*.hpp' -o -name '*.h' -o -name '*.hpp.in'
# [guards] A prefix used for include guards.
INCLUDE_GUARD_PREFIX = "AWKGWARD_"
# [doc_doxygen] List of Doxygen files.
DOC_DOXYGEN_FILES =
# [doc_qdoc] List of qdoc files.
DOC_QDOC_FILES =
# [doc] Project-specific targets.
DOC_PROJECT_TARGETS =
# [guards] Directories, where include guards should be updated.
INCLUDE_GUARDS_DIRS = $(INCLUDE_DIRS)
# [guards] Find expression that can be used to exclude some directories.
INCLUDE_GUARDS_EXCLUDE =
# [guards] Shell script that invokes 'awkgward.awk'.
AWKGWARD = awkgward/awkgward.sh
# [license_dslash] Directories, where licenses with double slash comments should be applied.
LICENSE_DSLASH_DIRS = /dev/null
# [license_dslash] File types for which licenses with double slash comments should be applied.
LICENSE_DSLASH_FILE_TYPES = $(INCLUDE_FILE_TYPES) -o $(SOURCE_FILE_TYPES) -o $(QML_FILE_TYPES) -o $(QBS_FILE_TYPES) -o $(JS_FILE_TYPES)
# [license_hash] Directories, where licenses with hash comments should be applied.
LICENSE_HASH_DIRS = /dev/null
# [license_hash] File types for which licenses with hash comments should be applied.
LICENSE_HASH_FILE_TYPES = $(CMAKE_FILE_TYPES)
# [license_xml] Directories, where licenses with XML comments should be applied.
LICENSE_XML_DIRS = /dev/null
# [license_xml] File types for which licenses with XML comments should be applied.
LICENSE_XML_FILE_TYPES = $(XML_FILE_TYPES)
# [license] Make license script.
MAKELIC = awkgward/makelic.sh
# [messages] Messages l10n-kf5 file.
MESSAGES_FILE = Messages.sh
# [messages] Messages generation script.
GENERATE_MESSAGES = awkgward/generate_messages.sh
include Makefile.project
.PHONY: help description env license guards doc doc_clean doc_doxygen ports messages extract_messages
help: description env
@echo --------------------------------------------------------------------------------
@echo Make targets are:
@echo help - display this help box.
@echo license[_dslash][_hash][_xml] - append license footer to files [comment style].
@echo guards - update include guards.
@echo messages[_extract] - generate l10n-kf5 Messages.sh file [and extract messages].
@echo doc[_clean] - generate [or clean] documentation.
@echo ports[_clean][_jobs] - make [clean][build jobs of] external libraries.
@echo --------------------------------------------------------------------------------
@echo Note: you can create Makefile.user file to override Make variables.
description:
@echo --------------------------------------------------------------------------------
@echo $(HELP_MESSAGE)
# Double quotes are required for printing path reliably with raw mingw32-make (without MSYS shell).
env:
@echo --------------------------------------------------------------------------------
@echo OS = "$(OS)"
@echo PATH = "$(PATH)"
@echo BUILD_MACHINE = "$(BUILD_MACHINE)"
license: license_dslash license_hash license_xml
license_dslash: $(MAKELIC) $(LICENSE_DSLASH_DIRS) | $(FIND) $(SH) $(AWK) $(DIRNAME) $(MAKELIC) $(STAT) $(CUT) $(UNIQ) $(PASTE) $(GREP) $(TOUCH) $(SED) $(ECHO) $(CAT) $(RM) $(GIT)
@echo Applying licenses using double slash comment...
@$(FIND) $(LICENSE_DSLASH_DIRS) -type f -name $(LICENSE_DSLASH) -exec $(SH) $(MAKELIC) {} dslash '$(LICENSE_DSLASH_FILE_TYPES)' $(NATIVE_IORS) $(FIND) $(GIT) \;
license_hash: $(MAKELIC) $(LICENSE_HASH_DIRS) | $(FIND) $(SH) $(AWK) $(DIRNAME) $(MAKELIC) $(STAT) $(CUT) $(UNIQ) $(PASTE) $(GREP) $(TOUCH) $(SED) $(ECHO) $(CAT) $(RM) $(GIT)
@echo Applying licenses using hash comment...
@$(FIND) $(LICENSE_HASH_DIRS) -type f -name $(LICENSE_HASH) -exec $(SH) $(MAKELIC) {} hash '$(LICENSE_HASH_FILE_TYPES)' $(NATIVE_IORS) $(FIND) $(GIT) \;
license_xml: $(MAKELIC) $(LICENSE_XML_DIRS) | $(FIND) $(SH) $(AWK) $(DIRNAME) $(MAKELIC) $(STAT) $(CUT) $(UNIQ) $(PASTE) $(GREP) $(TOUCH) $(SED) $(ECHO) $(CAT) $(RM) $(GIT)
@echo Applying licenses using XML comment...
@$(FIND) $(LICENSE_XML_DIRS) -type f -name $(LICENSE_XML) -exec $(SH) $(MAKELIC) {} xml '$(LICENSE_XML_FILE_TYPES)' $(NATIVE_IORS) $(FIND) $(GIT) \;
guards: $(AWKGWARD) $(INCLUDE_GUARDS_DIRS) | $(FIND) $(SH) $(AWK) $(CUT) $(GREP) $(TOUCH) $(STAT) $(AWK) $(ECHO) $(MV)
@echo Updating include guards...
@$(FIND) $(INCLUDE_GUARDS_DIRS) -type f \( $(INCLUDE_FILE_TYPES) \) $(INCLUDE_GUARDS_EXCLUDE) -exec $(SH) $(AWKGWARD) $(AWK) {} $(INCLUDE_GUARD_PREFIX) $(NATIVE_IORS) \;
messages:
@echo "#!/usr/bin/env bash" > $(MESSAGES_FILE)
@echo "" >> $(MESSAGES_FILE)
@$(GENERATE_MESSAGES) . extensions >> $(MESSAGES_FILE)
@$(GENERATE_MESSAGES) . tools >> $(MESSAGES_FILE)
messages_extract: messages | $(MKDIR) $(SVN)
@$(MKDIR) -p po
@$(MKDIR) -p enpo
@$(SVN) checkout svn://anonsvn.kde.org/home/kde/trunk/l10n-kf5/scripts
PATH=./scripts:$$PATH $(BASH) ./scripts/extract-messages.sh
doc: | $(MAKE)
@$(MAKE) -C . doc_project_targets
@$(MAKE) -C . doc_doxygen
doc_doxygen: | $(FIND) $(SED) $(DOXYGEN)
@echo Doxygen path: "$(DOXYGEN)"
@echo Doxygen version: "$(shell $(DOXYGEN) -v)"
@$(FIND) $(DOXYGEN_INPUT_DIRS) \
\( -name 'Doxyfile' -o -name '*.Doxyfile' \) \
-execdir $(DOXYGEN) {} \;
doc_clean: | $(FIND)
@$(FIND) $(DOXYGEN_OUTPUT_DIR) -type f -delete
doc_project_targets: $(DOC_PROJECT_TARGETS)
ports: | $(MAKE)
$(MAKE) -C external/recipes/$(BUILD_MACHINE)
ports_clean: | $(MAKE)
$(MAKE) -C external/recipes/$(BUILD_MACHINE) clean
ports_jobs:
@echo Variable MAKE_BUILD_JOBS controls the number of parallel build jobs in recipes.
@echo To alter the number of parallel build jobs either pass it as Make argument,
@echo or override it in 'Makefile.user' file.
@echo MAKE_BUILD_JOBS = $(MAKE_BUILD_JOBS)