Implement recursive mutex
[helenos.git] / Makefile
bloba72e73540773a90d3844fd3bc477a6be14f030e1
2 # Copyright (c) 2006 Martin Decky
3 # All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
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.
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.
29 # Just for this Makefile. Sub-makes will run in parallel if requested.
30 .NOTPARALLEL:
32 CSCOPE = cscope
33 FORMAT = clang-format
34 CHECK = tools/check.sh
35 CONFIG = tools/config.py
36 AUTOTOOL = tools/autotool.py
37 SANDBOX = autotool
39 CONFIG_RULES = HelenOS.config
41 COMMON_MAKEFILE = Makefile.common
42 COMMON_HEADER = common.h
44 CONFIG_MAKEFILE = Makefile.config
45 CONFIG_HEADER = config.h
47 .PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace
49 all: kernel uspace
50 $(MAKE) -r -C boot PRECHECK=$(PRECHECK)
52 common: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER)
54 kernel: common
55 $(MAKE) -r -C kernel PRECHECK=$(PRECHECK)
57 uspace: common
58 $(MAKE) -r -C uspace PRECHECK=$(PRECHECK)
60 precheck: clean
61 $(MAKE) -r all PRECHECK=y
63 cscope:
64 find abi kernel boot uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
66 cscope_parts:
67 find abi -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_abi.out
68 find kernel -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_kernel.out
69 find boot -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_boot.out
70 find uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_uspace.out
72 format:
73 find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
75 # Pre-integration build check
76 check: $(CHECK)
77 ifdef JOBS
78 $(CHECK) -j $(JOBS)
79 else
80 $(CHECK)
81 endif
83 # Autotool (detects compiler features)
85 autotool $(COMMON_MAKEFILE) $(COMMON_HEADER): $(CONFIG_MAKEFILE) $(AUTOTOOL)
86 $(AUTOTOOL)
87 diff -q $(COMMON_HEADER).new $(COMMON_HEADER) 2> /dev/null; if [ $$? -ne 0 ]; then mv -f $(COMMON_HEADER).new $(COMMON_HEADER); fi
89 # Build-time configuration
91 config_default $(CONFIG_MAKEFILE) $(CONFIG_HEADER): $(CONFIG_RULES)
92 ifeq ($(HANDS_OFF),y)
93 $(CONFIG) $< hands-off $(PROFILE)
94 else
95 $(CONFIG) $< default $(PROFILE)
96 endif
98 config: $(CONFIG_RULES)
99 $(CONFIG) $<
101 random-config: $(CONFIG_RULES)
102 $(CONFIG) $< random
104 # Release files
106 releasefile: all
107 $(MAKE) -r -C release releasefile
109 release:
110 $(MAKE) -r -C release release
112 # Cleaning
114 distclean: clean
115 rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc release/HelenOS-*
117 clean:
118 rm -fr $(SANDBOX)
119 $(MAKE) -r -C kernel clean
120 $(MAKE) -r -C uspace clean
121 $(MAKE) -r -C boot clean
123 -include Makefile.local