source: mainline/Makefile@ 4b42382

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 4b42382 was 92fff0c, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 6 years ago

wip

  • Property mode set to 100644
File size: 4.9 KB
Line 
1#
2# Copyright (c) 2006 Martin Decky
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
29# Just for this Makefile. Sub-makes will run in parallel if requested.
30.NOTPARALLEL:
31
32CCHECK = tools/sycek/ccheck
33CSCOPE = cscope
34FORMAT = clang-format
35CHECK = tools/check.sh
36CONFIG = tools/config.py
37MESON = meson
38
39BUILD_DIR=$(abspath build)
40
41CONFIG_RULES = HelenOS.config
42
43CONFIG_MAKEFILE = Makefile.config
44CONFIG_HEADER = config.h
45ERRNO_HEADER = abi/include/abi/errno.h
46ERRNO_INPUT = abi/include/abi/errno.in
47
48-include $(CONFIG_MAKEFILE)
49-include $(COMMON_MAKEFILE)
50
51# TODO: make meson reconfigure correctly when library build changes
52
53ifeq ($(CONFIG_BUILD_SHARED_LIBS),y)
54 MESON_ARGS = -Ddefault_library=shared
55else
56 MESON_ARGS = -Ddefault_library=static
57endif
58
59CROSS_PREFIX ?= /usr/local/cross
60CROSS_PATH = $(CROSS_PREFIX)/bin
61
62CROSS_TARGET ?= $(UARCH)
63
64ifeq ($(MACHINE),bmalta)
65 CROSS_TARGET = mips32eb
66endif
67
68.PHONY: all precheck cscope cscope_parts config_default config distclean clean check releasefile release meson space
69
70all: meson
71
72$(BUILD_DIR)/build.ninja: Makefile.config version
73 PATH="$(CROSS_PATH):$$PATH" meson . $(BUILD_DIR) --cross-file meson/cross/$(CROSS_TARGET) $(MESON_ARGS)
74
75meson: $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(ERRNO_HEADER) $(BUILD_DIR)/build.ninja
76 PATH="$(CROSS_PATH):$$PATH" ninja -C $(BUILD_DIR)
77
78test-xcw: meson
79ifeq ($(CONFIG_DEVEL_FILES),y)
80 export PATH=$$PATH:$(abspath tools/xcw/bin) && $(MAKE) -r -C tools/xcw/demo
81endif
82
83precheck: clean
84 $(MAKE) -r all PRECHECK=y
85
86cscope:
87 find abi kernel boot uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
88
89cscope_parts:
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
94
95format:
96 find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
97
98ccheck: $(CCHECK)
99 cd tools && ./build-ccheck.sh
100 tools/ccheck.sh
101
102ccheck-fix: $(CCHECK)
103 cd tools && ./build-ccheck.sh
104 tools/ccheck.sh --fix
105
106$(CCHECK):
107 cd tools && ./build-ccheck.sh
108
109space:
110 tools/srepl '[ \t]\+$$' ''
111
112doxy: $(BUILD_DIR)/build.ninja
113 ninja -C $(BUILD_DIR) doxygen
114
115# Pre-integration build check
116check: ccheck $(CHECK)
117ifdef JOBS
118 $(CHECK) -j $(JOBS)
119else
120 $(CHECK) -j $(shell nproc)
121endif
122
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.
125check_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
130# Build-time configuration
131
132config_default $(CONFIG_MAKEFILE) $(CONFIG_HEADER): $(CONFIG_RULES)
133ifeq ($(HANDS_OFF),y)
134 $(CONFIG) $< hands-off $(PROFILE)
135else
136 $(CONFIG) $< default $(PROFILE)
137endif
138
139config: $(CONFIG_RULES)
140 $(CONFIG) $<
141
142random-config: $(CONFIG_RULES)
143 $(CONFIG) $< random
144
145# Release files
146
147releasefile: all
148 $(MAKE) -r -C release releasefile
149
150release:
151 $(MAKE) -r -C release release
152
153# Cleaning
154
155distclean: clean
156 rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc release/HelenOS-*
157
158clean:
159 $(MAKE) -r -C tools/xcw/demo clean
160
161$(ERRNO_HEADER): $(ERRNO_INPUT)
162 echo '/* Generated file. Edit errno.in instead. */' > $@.new
163 sed 's/__errno_entry(\([^,]*\),\([^,]*\),.*/#define \1 __errno_t(\2)/' < $< >> $@.new
164 mv $@.new $@
165
166-include Makefile.local
Note: See TracBrowser for help on using the repository browser.