source: mainline/Makefile@ 667c3fc

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

Fix handling of CONFIG_BUILD_SHARED_LIBS

  • 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 = $(abspath tools/config.py)
37MESON = meson
38
39BUILD_DIR=$(abspath build)
40
41CONFIG_RULES = HelenOS.config
42
43CONFIG_MAKEFILE = $(BUILD_DIR)/Makefile.config
44CONFIG_HEADER = $(BUILD_DIR)/config.h
45ERRNO_HEADER = abi/include/abi/errno.h
46ERRNO_INPUT = abi/include/abi/errno.in
47VERSION_FILE = version
48
49-include $(CONFIG_MAKEFILE)
50-include $(COMMON_MAKEFILE)
51
52CROSS_TARGET ?= $(UARCH)
53
54ifeq ($(MACHINE),bmalta)
55 CROSS_TARGET = mips32eb
56endif
57
58.PHONY: all precheck cscope cscope_parts config_default config distclean clean check releasefile release meson space
59
60all: meson
61
62$(BUILD_DIR)/build.ninja: $(CONFIG_MAKEFILE) $(VERSION_FILE)
63 meson . $(BUILD_DIR) --cross-file meson/cross/$(CROSS_TARGET)
64
65meson: $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(ERRNO_HEADER) $(BUILD_DIR)/build.ninja
66 ninja -C $(BUILD_DIR)
67
68test-xcw: meson
69ifeq ($(CONFIG_DEVEL_FILES),y)
70 export PATH=$$PATH:$(abspath tools/xcw/bin) && $(MAKE) -r -C tools/xcw/demo
71endif
72
73precheck: clean
74 $(MAKE) -r all PRECHECK=y
75
76cscope:
77 find abi kernel boot uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
78
79cscope_parts:
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
84
85format:
86 find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
87
88ccheck: $(CCHECK)
89 cd tools && ./build-ccheck.sh
90 tools/ccheck.sh
91
92ccheck-fix: $(CCHECK)
93 cd tools && ./build-ccheck.sh
94 tools/ccheck.sh --fix
95
96$(CCHECK):
97 cd tools && ./build-ccheck.sh
98
99space:
100 tools/srepl '[ \t]\+$$' ''
101
102doxy: $(BUILD_DIR)/build.ninja
103 ninja -C $(BUILD_DIR) doxygen
104
105# Pre-integration build check
106check: ccheck $(CHECK)
107ifdef JOBS
108 $(CHECK) -j $(JOBS)
109else
110 $(CHECK) -j $(shell nproc)
111endif
112
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.
115check_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
120# Build-time configuration
121
122config_default $(CONFIG_MAKEFILE) $(CONFIG_HEADER): $(CONFIG_RULES)
123 mkdir -p $(BUILD_DIR)
124ifeq ($(HANDS_OFF),y)
125 cd $(BUILD_DIR) && $(CONFIG) $(abspath $<) $(abspath defaults) hands-off $(PROFILE)
126else
127 cd $(BUILD_DIR) && $(CONFIG) $(abspath $<) $(abspath defaults) default $(PROFILE)
128endif
129
130config: $(CONFIG_RULES)
131 mkdir -p $(BUILD_DIR)
132 cd $(BUILD_DIR) && $(CONFIG) $(abspath $<) $(abspath defaults)
133
134random-config: $(CONFIG_RULES)
135 mkdir -p $(BUILD_DIR)
136 cd $(BUILD_DIR) && $(CONFIG) $(abspath $<) $(abspath defaults) random
137
138# Release files
139
140releasefile: all
141 $(MAKE) -r -C release releasefile
142
143release:
144 $(MAKE) -r -C release release
145
146# Cleaning
147
148distclean: clean
149 rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc release/HelenOS-*
150
151clean:
152 $(MAKE) -r -C tools/xcw/demo clean
153
154$(ERRNO_HEADER): $(ERRNO_INPUT)
155 echo '/* Generated file. Edit errno.in instead. */' > $@.new
156 sed 's/__errno_entry(\([^,]*\),\([^,]*\),.*/#define \1 __errno_t(\2)/' < $< >> $@.new
157 mv $@.new $@
158
159-include Makefile.local
Note: See TracBrowser for help on using the repository browser.