File indexing completed on 2024-12-22 05:20:26

0001 # Copyright (c) 2018, Michal Policht. This file is dually licensed under terms of
0002 # either WTFPL or BEER-WARE LICENSE. You may obtain the copy of WTFPL or BEER-WARE
0003 # LICENSE by googling, binging, yahooing or downloading it from pirate bay.
0004 # NO WARRANTY.
0005 
0006 
0007 first: help
0008 
0009 # [help] Help message to be printed.
0010 
0011 HELP_MESSAGE =
0012 
0013 # [license] Names of files containing license text to be appended to files, commented out with double slash.
0014 LICENSE_DSLASH = 'LICENSE.*.dslash.inc'
0015 
0016 # [license] Names of files containing license text to be appended to files, commented out with hash.
0017 LICENSE_HASH = 'LICENSE.*.hash.inc'
0018 
0019 # [license] Names of files containing license text to be appended to files, commented out with XML comment.
0020 LICENSE_XML = 'LICENSE.*.xml.inc'
0021 
0022 # [license] CMake file types.
0023 CMAKE_FILE_TYPES = -name '*.cmake' -o -name 'CMakeLists.txt'
0024 
0025 # [license] Qbs file types.
0026 QBS_FILE_TYPES = -name '*.qbs'
0027 
0028 # [license] QML file types.
0029 QML_FILE_TYPES = -name '*.qml'
0030 
0031 # [license] JavaScript file types.
0032 JS_FILE_TYPES = -name '*.js'
0033 
0034 # [license] XML file types.
0035 XML_FILE_TYPES = -name '*.xml'
0036 
0037 # [license] Source file types.
0038 SOURCE_FILE_TYPES = -name '*.cpp' -o -name '*.c' -o -name '*.cpp.in'
0039 
0040 # [license, guards] Include file types.
0041 INCLUDE_FILE_TYPES = -name '*.hpp' -o -name '*.h' -o -name '*.hpp.in'
0042 
0043 # [guards] A prefix used for include guards.
0044 INCLUDE_GUARD_PREFIX = "AWKGWARD_"
0045 
0046 # [doc_doxygen] List of Doxygen files.
0047 DOC_DOXYGEN_FILES =
0048 
0049 # [doc_qdoc] List of qdoc files.
0050 DOC_QDOC_FILES =
0051 
0052 # [doc] Project-specific targets.
0053 DOC_PROJECT_TARGETS =
0054 
0055 # [guards] Directories, where include guards should be updated.
0056 INCLUDE_GUARDS_DIRS = $(INCLUDE_DIRS)
0057 
0058 # [guards] Find expression that can be used to exclude some directories.
0059 INCLUDE_GUARDS_EXCLUDE =
0060 
0061 # [guards] Shell script that invokes 'awkgward.awk'.
0062 AWKGWARD = awkgward/awkgward.sh
0063 
0064 # [license_dslash] Directories, where licenses with double slash comments should be applied.
0065 LICENSE_DSLASH_DIRS = /dev/null
0066 
0067 # [license_dslash] File types for which licenses with double slash comments should be applied.
0068 LICENSE_DSLASH_FILE_TYPES = $(INCLUDE_FILE_TYPES) -o $(SOURCE_FILE_TYPES) -o $(QML_FILE_TYPES) -o $(QBS_FILE_TYPES) -o $(JS_FILE_TYPES)
0069 
0070 # [license_hash] Directories, where licenses with hash comments should be applied.
0071 LICENSE_HASH_DIRS = /dev/null
0072 
0073 # [license_hash] File types for which licenses with hash comments should be applied.
0074 LICENSE_HASH_FILE_TYPES = $(CMAKE_FILE_TYPES)
0075 
0076 # [license_xml] Directories, where licenses with XML comments should be applied.
0077 LICENSE_XML_DIRS = /dev/null
0078 
0079 # [license_xml] File types for which licenses with XML comments should be applied.
0080 LICENSE_XML_FILE_TYPES = $(XML_FILE_TYPES)
0081 
0082 # [license] Make license script.
0083 MAKELIC = awkgward/makelic.sh
0084 
0085 # [messages] Messages l10n-kf5 file.
0086 MESSAGES_FILE = Messages.sh
0087 
0088 # [messages] Messages generation script.
0089 GENERATE_MESSAGES = awkgward/generate_messages.sh
0090 
0091 include Makefile.project
0092 
0093 
0094 .PHONY: help description env license guards doc doc_clean doc_doxygen ports messages extract_messages
0095 
0096 help: description env
0097                 @echo --------------------------------------------------------------------------------
0098                 @echo Make targets are:
0099                 @echo help - display this help box.
0100                 @echo license[_dslash][_hash][_xml] - append license footer to files [comment style].
0101                 @echo guards - update include guards.
0102                 @echo messages[_extract] - generate l10n-kf5 Messages.sh file [and extract messages].
0103                 @echo doc[_clean] - generate [or clean] documentation.
0104                 @echo ports[_clean][_jobs] - make [clean][build jobs of] external libraries.
0105                 @echo --------------------------------------------------------------------------------
0106                 @echo Note: you can create Makefile.user file to override Make variables.
0107 
0108 description:
0109                 @echo --------------------------------------------------------------------------------
0110                 @echo $(HELP_MESSAGE)
0111 
0112 # Double quotes are required for printing path reliably with raw mingw32-make (without MSYS shell).
0113 env:
0114                 @echo --------------------------------------------------------------------------------
0115                 @echo OS = "$(OS)"
0116                 @echo PATH = "$(PATH)"
0117                 @echo BUILD_MACHINE = "$(BUILD_MACHINE)"
0118 
0119 license: license_dslash license_hash license_xml
0120 
0121 license_dslash: $(MAKELIC) $(LICENSE_DSLASH_DIRS) | $(FIND) $(SH) $(AWK) $(DIRNAME) $(MAKELIC) $(STAT) $(CUT) $(UNIQ) $(PASTE) $(GREP) $(TOUCH) $(SED) $(ECHO) $(CAT) $(RM) $(GIT)
0122                 @echo Applying licenses using double slash comment...
0123                 @$(FIND) $(LICENSE_DSLASH_DIRS) -type f -name $(LICENSE_DSLASH) -exec $(SH) $(MAKELIC) {} dslash '$(LICENSE_DSLASH_FILE_TYPES)' $(NATIVE_IORS) $(FIND) $(GIT) \;
0124 
0125 license_hash: $(MAKELIC) $(LICENSE_HASH_DIRS) | $(FIND) $(SH) $(AWK) $(DIRNAME) $(MAKELIC) $(STAT) $(CUT) $(UNIQ) $(PASTE) $(GREP) $(TOUCH) $(SED) $(ECHO) $(CAT) $(RM) $(GIT)
0126                 @echo Applying licenses using hash comment...
0127                 @$(FIND) $(LICENSE_HASH_DIRS) -type f -name $(LICENSE_HASH) -exec $(SH) $(MAKELIC) {} hash '$(LICENSE_HASH_FILE_TYPES)' $(NATIVE_IORS) $(FIND) $(GIT) \;
0128 
0129 license_xml: $(MAKELIC) $(LICENSE_XML_DIRS) | $(FIND) $(SH) $(AWK) $(DIRNAME) $(MAKELIC) $(STAT) $(CUT) $(UNIQ) $(PASTE) $(GREP) $(TOUCH) $(SED) $(ECHO) $(CAT) $(RM) $(GIT)
0130                 @echo Applying licenses using XML comment...
0131                 @$(FIND) $(LICENSE_XML_DIRS) -type f -name $(LICENSE_XML) -exec $(SH) $(MAKELIC) {} xml '$(LICENSE_XML_FILE_TYPES)' $(NATIVE_IORS) $(FIND) $(GIT) \;
0132 
0133 guards: $(AWKGWARD) $(INCLUDE_GUARDS_DIRS) | $(FIND) $(SH) $(AWK) $(CUT) $(GREP) $(TOUCH) $(STAT) $(AWK) $(ECHO) $(MV)
0134                 @echo Updating include guards...
0135                 @$(FIND) $(INCLUDE_GUARDS_DIRS) -type f \( $(INCLUDE_FILE_TYPES) \) $(INCLUDE_GUARDS_EXCLUDE) -exec $(SH) $(AWKGWARD) $(AWK) {} $(INCLUDE_GUARD_PREFIX) $(NATIVE_IORS) \;
0136 
0137 messages:
0138         @echo "#!/usr/bin/env bash" > $(MESSAGES_FILE)
0139         @echo "" >> $(MESSAGES_FILE)
0140         @$(GENERATE_MESSAGES) . extensions >> $(MESSAGES_FILE)
0141         @$(GENERATE_MESSAGES) . tools >> $(MESSAGES_FILE)
0142 
0143 messages_extract: messages | $(MKDIR) $(SVN)
0144         @$(MKDIR) -p po
0145         @$(MKDIR) -p enpo
0146         @$(SVN) checkout svn://anonsvn.kde.org/home/kde/trunk/l10n-kf5/scripts
0147         PATH=./scripts:$$PATH $(BASH) ./scripts/extract-messages.sh
0148 
0149 doc: | $(MAKE)
0150                 @$(MAKE) -C . doc_project_targets
0151                 @$(MAKE) -C . doc_doxygen
0152 
0153 doc_doxygen: | $(FIND) $(SED) $(DOXYGEN)
0154                 @echo Doxygen path: "$(DOXYGEN)"
0155                 @echo Doxygen version: "$(shell $(DOXYGEN) -v)"
0156                 @$(FIND) $(DOXYGEN_INPUT_DIRS) \
0157                 \( -name 'Doxyfile' -o -name '*.Doxyfile' \) \
0158                 -execdir $(DOXYGEN) {} \;
0159 
0160 doc_clean: | $(FIND)
0161                 @$(FIND) $(DOXYGEN_OUTPUT_DIR) -type f -delete
0162 
0163 doc_project_targets: $(DOC_PROJECT_TARGETS)
0164 
0165 ports: | $(MAKE)
0166                 $(MAKE) -C external/recipes/$(BUILD_MACHINE)
0167 
0168 ports_clean: | $(MAKE)
0169                 $(MAKE) -C external/recipes/$(BUILD_MACHINE) clean
0170 
0171 ports_jobs:
0172                 @echo Variable MAKE_BUILD_JOBS controls the number of parallel build jobs in recipes.
0173                 @echo To alter the number of parallel build jobs either pass it as Make argument,
0174                 @echo or override it in 'Makefile.user' file.
0175                 @echo MAKE_BUILD_JOBS = $(MAKE_BUILD_JOBS)