[3654684] | 1 | #
|
---|
[df4ed85] | 2 | # Copyright (c) 2006 Martin Decky
|
---|
[41f7564] | 3 | # All rights reserved.
|
---|
| 4 | #
|
---|
| 5 | # Redistribution and use in source and binary forms, with or without
|
---|
| 6 | # modification, are permitted provided that the following conditions
|
---|
| 7 | # are met:
|
---|
| 8 | #
|
---|
| 9 | # - Redistributions of source code must retain the above copyright
|
---|
| 10 | # notice, this list of conditions and the following disclaimer.
|
---|
| 11 | # - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | # notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | # documentation and/or other materials provided with the distribution.
|
---|
| 14 | # - The name of the author may not be used to endorse or promote products
|
---|
| 15 | # derived from this software without specific prior written permission.
|
---|
| 16 | #
|
---|
| 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | #
|
---|
| 28 |
|
---|
[bb285b4] | 29 | # Just for this Makefile. Sub-makes will run in parallel if requested.
|
---|
| 30 | .NOTPARALLEL:
|
---|
| 31 |
|
---|
[db3089d] | 32 | CCHECK = tools/sycek/ccheck
|
---|
[218e50c] | 33 | CSCOPE = cscope
|
---|
[b1efe3e] | 34 | FORMAT = clang-format
|
---|
[eb221e5] | 35 | CHECK = tools/check.sh
|
---|
[8786aa5] | 36 | CONFIG = tools/config.py
|
---|
[5fd05862] | 37 | MESON = meson
|
---|
[4e9aaf5] | 38 |
|
---|
[e428bec] | 39 | BUILD_DIR=$(abspath build)
|
---|
| 40 |
|
---|
[4e9aaf5] | 41 | CONFIG_RULES = HelenOS.config
|
---|
| 42 |
|
---|
| 43 | CONFIG_MAKEFILE = Makefile.config
|
---|
| 44 | CONFIG_HEADER = config.h
|
---|
[3529fbf0] | 45 | ERRNO_HEADER = abi/include/abi/errno.h
|
---|
| 46 | ERRNO_INPUT = abi/include/abi/errno.in
|
---|
[656437a0] | 47 |
|
---|
[5fd05862] | 48 | -include $(CONFIG_MAKEFILE)
|
---|
| 49 | -include $(COMMON_MAKEFILE)
|
---|
| 50 |
|
---|
| 51 | # TODO: make meson reconfigure correctly when library build changes
|
---|
| 52 |
|
---|
| 53 | ifeq ($(CONFIG_BUILD_SHARED_LIBS),y)
|
---|
| 54 | MESON_ARGS = -Ddefault_library=shared
|
---|
| 55 | else
|
---|
| 56 | MESON_ARGS = -Ddefault_library=static
|
---|
| 57 | endif
|
---|
| 58 |
|
---|
[1783f75] | 59 | CROSS_PREFIX ?= /usr/local/cross
|
---|
| 60 | CROSS_PATH = $(CROSS_PREFIX)/bin
|
---|
[5fd05862] | 61 |
|
---|
[5f176da] | 62 | CROSS_TARGET ?= $(UARCH)
|
---|
| 63 |
|
---|
[63660a3] | 64 | ifeq ($(MACHINE),bmalta)
|
---|
[5f176da] | 65 | CROSS_TARGET = mips32eb
|
---|
[63660a3] | 66 | endif
|
---|
| 67 |
|
---|
[e503cea9] | 68 | .PHONY: all precheck cscope cscope_parts config_default config distclean clean check releasefile release meson space
|
---|
[41f7564] | 69 |
|
---|
[1783f75] | 70 | all: meson
|
---|
[feab36ae] | 71 |
|
---|
[e428bec] | 72 | $(BUILD_DIR)/build.ninja: Makefile.config version
|
---|
[5f176da] | 73 | PATH="$(CROSS_PATH):$$PATH" meson . $(BUILD_DIR) --cross-file meson/cross/$(CROSS_TARGET) $(MESON_ARGS)
|
---|
[5fd05862] | 74 |
|
---|
[2b2783b] | 75 | meson: $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(ERRNO_HEADER) $(BUILD_DIR)/build.ninja
|
---|
[e428bec] | 76 | PATH="$(CROSS_PATH):$$PATH" ninja -C $(BUILD_DIR)
|
---|
[41f7564] | 77 |
|
---|
[1783f75] | 78 | test-xcw: meson
|
---|
[5fd05862] | 79 | ifeq ($(CONFIG_DEVEL_FILES),y)
|
---|
[4640416] | 80 | export PATH=$$PATH:$(abspath tools/xcw/bin) && $(MAKE) -r -C tools/xcw/demo
|
---|
[5fd05862] | 81 | endif
|
---|
[a5c468e] | 82 |
|
---|
[8786aa5] | 83 | precheck: clean
|
---|
[e540bc87] | 84 | $(MAKE) -r all PRECHECK=y
|
---|
[656437a0] | 85 |
|
---|
| 86 | cscope:
|
---|
[6eda732] | 87 | find abi kernel boot uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
|
---|
[656437a0] | 88 |
|
---|
[efb94a77] | 89 | cscope_parts:
|
---|
[6eda732] | 90 | find abi -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_abi.out
|
---|
| 91 | find kernel -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_kernel.out
|
---|
| 92 | find boot -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_boot.out
|
---|
| 93 | find uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_uspace.out
|
---|
[efb94a77] | 94 |
|
---|
[b1efe3e] | 95 | format:
|
---|
| 96 | find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
|
---|
| 97 |
|
---|
[db3089d] | 98 | ccheck: $(CCHECK)
|
---|
[a4eb3ba2] | 99 | cd tools && ./build-ccheck.sh
|
---|
[db3089d] | 100 | tools/ccheck.sh
|
---|
| 101 |
|
---|
[e347396] | 102 | ccheck-fix: $(CCHECK)
|
---|
[a4eb3ba2] | 103 | cd tools && ./build-ccheck.sh
|
---|
[e347396] | 104 | tools/ccheck.sh --fix
|
---|
| 105 |
|
---|
[86b70c6] | 106 | $(CCHECK):
|
---|
| 107 | cd tools && ./build-ccheck.sh
|
---|
| 108 |
|
---|
[34e1206] | 109 | space:
|
---|
| 110 | tools/srepl '[ \t]\+$$' ''
|
---|
| 111 |
|
---|
[e503cea9] | 112 | doxy: $(BUILD_DIR)/build.ninja
|
---|
| 113 | ninja -C $(BUILD_DIR) doxygen
|
---|
[7f345cd0] | 114 |
|
---|
[eb221e5] | 115 | # Pre-integration build check
|
---|
[e8f6f94] | 116 | check: ccheck $(CHECK)
|
---|
[3061bc1] | 117 | ifdef JOBS
|
---|
[eb221e5] | 118 | $(CHECK) -j $(JOBS)
|
---|
| 119 | else
|
---|
[5261062] | 120 | $(CHECK) -j $(shell nproc)
|
---|
[eb221e5] | 121 | endif
|
---|
| 122 |
|
---|
[3c7702c0] | 123 | # `sed` pulls a list of "compatibility-only" error codes from `errno.in`,
|
---|
| 124 | # the following grep finds instances of those error codes in HelenOS code.
|
---|
| 125 | check_errno:
|
---|
| 126 | @ ! cat abi/include/abi/errno.in | \
|
---|
| 127 | sed -n -e '1,/COMPAT_START/d' -e 's/__errno_entry(\([A-Z0-9]\+\).*/\\b\1\\b/p' | \
|
---|
| 128 | git grep -n -f - -- ':(exclude)abi' ':(exclude)uspace/lib/posix'
|
---|
| 129 |
|
---|
[83fd0d7] | 130 | # Build-time configuration
|
---|
| 131 |
|
---|
[c6f4681] | 132 | config_default $(CONFIG_MAKEFILE) $(CONFIG_HEADER): $(CONFIG_RULES)
|
---|
[e3c3172] | 133 | ifeq ($(HANDS_OFF),y)
|
---|
| 134 | $(CONFIG) $< hands-off $(PROFILE)
|
---|
| 135 | else
|
---|
[6ec0acd] | 136 | $(CONFIG) $< default $(PROFILE)
|
---|
[e3c3172] | 137 | endif
|
---|
[4cac212c] | 138 |
|
---|
[4e9aaf5] | 139 | config: $(CONFIG_RULES)
|
---|
| 140 | $(CONFIG) $<
|
---|
[41f7564] | 141 |
|
---|
[f857e8b] | 142 | random-config: $(CONFIG_RULES)
|
---|
| 143 | $(CONFIG) $< random
|
---|
| 144 |
|
---|
[471569b] | 145 | # Release files
|
---|
[83fd0d7] | 146 |
|
---|
[471569b] | 147 | releasefile: all
|
---|
[e540bc87] | 148 | $(MAKE) -r -C release releasefile
|
---|
[83fd0d7] | 149 |
|
---|
[471569b] | 150 | release:
|
---|
[e540bc87] | 151 | $(MAKE) -r -C release release
|
---|
[83fd0d7] | 152 |
|
---|
| 153 | # Cleaning
|
---|
| 154 |
|
---|
[9a0367f] | 155 | distclean: clean
|
---|
[32355bc] | 156 | rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc release/HelenOS-*
|
---|
[41f7564] | 157 |
|
---|
| 158 | clean:
|
---|
[a5c468e] | 159 | $(MAKE) -r -C tools/xcw/demo clean
|
---|
[4bc309b] | 160 |
|
---|
[3529fbf0] | 161 | $(ERRNO_HEADER): $(ERRNO_INPUT)
|
---|
| 162 | echo '/* Generated file. Edit errno.in instead. */' > $@.new
|
---|
[10de842] | 163 | sed 's/__errno_entry(\([^,]*\),\([^,]*\),.*/#define \1 __errno_t(\2)/' < $< >> $@.new
|
---|
[3529fbf0] | 164 | mv $@.new $@
|
---|
| 165 |
|
---|
[4bc309b] | 166 | -include Makefile.local
|
---|