| [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
|
|---|
| [2e2cefdb] | 36 | CONFIG = $(abspath tools/config.py)
|
|---|
| [5fd05862] | 37 | MESON = meson
|
|---|
| [4e9aaf5] | 38 |
|
|---|
| [e428bec] | 39 | BUILD_DIR=$(abspath build)
|
|---|
| 40 |
|
|---|
| [4e9aaf5] | 41 | CONFIG_RULES = HelenOS.config
|
|---|
| 42 |
|
|---|
| [2e2cefdb] | 43 | CONFIG_MAKEFILE = $(BUILD_DIR)/Makefile.config
|
|---|
| 44 | CONFIG_HEADER = $(BUILD_DIR)/config.h
|
|---|
| [3529fbf0] | 45 | ERRNO_HEADER = abi/include/abi/errno.h
|
|---|
| 46 | ERRNO_INPUT = abi/include/abi/errno.in
|
|---|
| [2e2cefdb] | 47 | VERSION_FILE = version
|
|---|
| [656437a0] | 48 |
|
|---|
| [5fd05862] | 49 | -include $(CONFIG_MAKEFILE)
|
|---|
| 50 | -include $(COMMON_MAKEFILE)
|
|---|
| 51 |
|
|---|
| [5f176da] | 52 | CROSS_TARGET ?= $(UARCH)
|
|---|
| 53 |
|
|---|
| [63660a3] | 54 | ifeq ($(MACHINE),bmalta)
|
|---|
| [5f176da] | 55 | CROSS_TARGET = mips32eb
|
|---|
| [63660a3] | 56 | endif
|
|---|
| 57 |
|
|---|
| [e503cea9] | 58 | .PHONY: all precheck cscope cscope_parts config_default config distclean clean check releasefile release meson space
|
|---|
| [41f7564] | 59 |
|
|---|
| [1783f75] | 60 | all: meson
|
|---|
| [feab36ae] | 61 |
|
|---|
| [2e2cefdb] | 62 | $(BUILD_DIR)/build.ninja: $(CONFIG_MAKEFILE) $(VERSION_FILE)
|
|---|
| [667c3fc] | 63 | meson . $(BUILD_DIR) --cross-file meson/cross/$(CROSS_TARGET)
|
|---|
| [5fd05862] | 64 |
|
|---|
| [2b2783b] | 65 | meson: $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(ERRNO_HEADER) $(BUILD_DIR)/build.ninja
|
|---|
| [d4b30cf] | 66 | ninja -C $(BUILD_DIR)
|
|---|
| [41f7564] | 67 |
|
|---|
| [1783f75] | 68 | test-xcw: meson
|
|---|
| [5fd05862] | 69 | ifeq ($(CONFIG_DEVEL_FILES),y)
|
|---|
| [4640416] | 70 | export PATH=$$PATH:$(abspath tools/xcw/bin) && $(MAKE) -r -C tools/xcw/demo
|
|---|
| [5fd05862] | 71 | endif
|
|---|
| [a5c468e] | 72 |
|
|---|
| [8786aa5] | 73 | precheck: clean
|
|---|
| [e540bc87] | 74 | $(MAKE) -r all PRECHECK=y
|
|---|
| [656437a0] | 75 |
|
|---|
| 76 | cscope:
|
|---|
| [6eda732] | 77 | find abi kernel boot uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
|
|---|
| [656437a0] | 78 |
|
|---|
| [efb94a77] | 79 | cscope_parts:
|
|---|
| [6eda732] | 80 | find abi -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_abi.out
|
|---|
| 81 | find kernel -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_kernel.out
|
|---|
| 82 | find boot -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_boot.out
|
|---|
| 83 | find uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_uspace.out
|
|---|
| [efb94a77] | 84 |
|
|---|
| [b1efe3e] | 85 | format:
|
|---|
| 86 | find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
|
|---|
| 87 |
|
|---|
| [db3089d] | 88 | ccheck: $(CCHECK)
|
|---|
| [a4eb3ba2] | 89 | cd tools && ./build-ccheck.sh
|
|---|
| [db3089d] | 90 | tools/ccheck.sh
|
|---|
| 91 |
|
|---|
| [e347396] | 92 | ccheck-fix: $(CCHECK)
|
|---|
| [a4eb3ba2] | 93 | cd tools && ./build-ccheck.sh
|
|---|
| [e347396] | 94 | tools/ccheck.sh --fix
|
|---|
| 95 |
|
|---|
| [86b70c6] | 96 | $(CCHECK):
|
|---|
| 97 | cd tools && ./build-ccheck.sh
|
|---|
| 98 |
|
|---|
| [34e1206] | 99 | space:
|
|---|
| 100 | tools/srepl '[ \t]\+$$' ''
|
|---|
| 101 |
|
|---|
| [e503cea9] | 102 | doxy: $(BUILD_DIR)/build.ninja
|
|---|
| 103 | ninja -C $(BUILD_DIR) doxygen
|
|---|
| [7f345cd0] | 104 |
|
|---|
| [eb221e5] | 105 | # Pre-integration build check
|
|---|
| [e8f6f94] | 106 | check: ccheck $(CHECK)
|
|---|
| [3061bc1] | 107 | ifdef JOBS
|
|---|
| [eb221e5] | 108 | $(CHECK) -j $(JOBS)
|
|---|
| 109 | else
|
|---|
| [5261062] | 110 | $(CHECK) -j $(shell nproc)
|
|---|
| [eb221e5] | 111 | endif
|
|---|
| 112 |
|
|---|
| [3c7702c0] | 113 | # `sed` pulls a list of "compatibility-only" error codes from `errno.in`,
|
|---|
| 114 | # the following grep finds instances of those error codes in HelenOS code.
|
|---|
| 115 | check_errno:
|
|---|
| 116 | @ ! cat abi/include/abi/errno.in | \
|
|---|
| 117 | sed -n -e '1,/COMPAT_START/d' -e 's/__errno_entry(\([A-Z0-9]\+\).*/\\b\1\\b/p' | \
|
|---|
| 118 | git grep -n -f - -- ':(exclude)abi' ':(exclude)uspace/lib/posix'
|
|---|
| 119 |
|
|---|
| [83fd0d7] | 120 | # Build-time configuration
|
|---|
| 121 |
|
|---|
| [c6f4681] | 122 | config_default $(CONFIG_MAKEFILE) $(CONFIG_HEADER): $(CONFIG_RULES)
|
|---|
| [2e2cefdb] | 123 | mkdir -p $(BUILD_DIR)
|
|---|
| [e3c3172] | 124 | ifeq ($(HANDS_OFF),y)
|
|---|
| [2e2cefdb] | 125 | cd $(BUILD_DIR) && $(CONFIG) $(abspath $<) $(abspath defaults) hands-off $(PROFILE)
|
|---|
| [e3c3172] | 126 | else
|
|---|
| [2e2cefdb] | 127 | cd $(BUILD_DIR) && $(CONFIG) $(abspath $<) $(abspath defaults) default $(PROFILE)
|
|---|
| [e3c3172] | 128 | endif
|
|---|
| [4cac212c] | 129 |
|
|---|
| [4e9aaf5] | 130 | config: $(CONFIG_RULES)
|
|---|
| [2e2cefdb] | 131 | mkdir -p $(BUILD_DIR)
|
|---|
| 132 | cd $(BUILD_DIR) && $(CONFIG) $(abspath $<) $(abspath defaults)
|
|---|
| [41f7564] | 133 |
|
|---|
| [f857e8b] | 134 | random-config: $(CONFIG_RULES)
|
|---|
| [2e2cefdb] | 135 | mkdir -p $(BUILD_DIR)
|
|---|
| 136 | cd $(BUILD_DIR) && $(CONFIG) $(abspath $<) $(abspath defaults) random
|
|---|
| [f857e8b] | 137 |
|
|---|
| [471569b] | 138 | # Release files
|
|---|
| [83fd0d7] | 139 |
|
|---|
| [471569b] | 140 | releasefile: all
|
|---|
| [e540bc87] | 141 | $(MAKE) -r -C release releasefile
|
|---|
| [83fd0d7] | 142 |
|
|---|
| [471569b] | 143 | release:
|
|---|
| [e540bc87] | 144 | $(MAKE) -r -C release release
|
|---|
| [83fd0d7] | 145 |
|
|---|
| 146 | # Cleaning
|
|---|
| 147 |
|
|---|
| [9a0367f] | 148 | distclean: clean
|
|---|
| [32355bc] | 149 | rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc release/HelenOS-*
|
|---|
| [41f7564] | 150 |
|
|---|
| 151 | clean:
|
|---|
| [a5c468e] | 152 | $(MAKE) -r -C tools/xcw/demo clean
|
|---|
| [4bc309b] | 153 |
|
|---|
| [3529fbf0] | 154 | $(ERRNO_HEADER): $(ERRNO_INPUT)
|
|---|
| 155 | echo '/* Generated file. Edit errno.in instead. */' > $@.new
|
|---|
| [10de842] | 156 | sed 's/__errno_entry(\([^,]*\),\([^,]*\),.*/#define \1 __errno_t(\2)/' < $< >> $@.new
|
|---|
| [3529fbf0] | 157 | mv $@.new $@
|
|---|
| 158 |
|
|---|
| [4bc309b] | 159 | -include Makefile.local
|
|---|