Makefile: Don’t invoke `src/Makefile` twice
[nit.git] / Makefile
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2008 Jean Privat <jean@pryen.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 NITCOPT=
18
19 contrib_dir = ./contrib
20 examples_dir = ./examples
21 all_contribs = $(dir $(contrib_dir)/*/Makefile)
22
23 # Additional program directories (contrib and examples) that are buildable
24 extras = $(filter-out $(contrib_dir)/nitc/,$(all_contribs))
25 extras += $(dir $(examples_dir)/*/Makefile)
26
27 all: tools man
28 @echo ""
29 @echo "Congratulations! Nit was succesfully compiled."
30 @echo "To configure your shell environment, execute the following command:"
31 @echo " source misc/nit_env.sh install"
32
33 # Compile all programs in `contrib`, `examples` and `src`.
34 #
35 # Furthermore, build the toolchain’s `man` pages.
36 full: all
37 for directory in $(extras); do \
38 (cd "$${directory}" && $(MAKE)) || exit 1; \
39 done
40
41 docs: doc/stdlib/index.html doc/nitc/index.html
42
43 tools:
44 cd src; make
45
46 bin/nitdoc:
47 cd src; make ../bin/nitdoc
48
49 bin/nitls:
50 cd src; make ../bin/nitls
51
52 doc/stdlib/index.html: bin/nitdoc bin/nitls
53 @echo '***************************************************************'
54 @echo '* Generate doc for NIT standard library *'
55 @echo '***************************************************************'
56 bin/nitdoc lib -d doc/stdlib \
57 --custom-title "Nit Standard Library" \
58 --custom-brand "<a href=\"http://nitlanguage.org/\">Nitlanguage.org</a>" \
59 --custom-overview-text "<p>Documentation for the standard library of Nit<br/>Version $$(git describe)<br/>Date: $$(git show --format="%cd" | head -1)</p>" \
60 --custom-footer-text "Nit standard library. Version $$(git describe)." \
61 --github-upstream "nitlang:nit:master" \
62 --github-base-sha1 "$$(git rev-parse HEAD)" \
63 --github-gitdir "." \
64 --source "https://github.com/nitlang/nit/blob/$$(git rev-parse HEAD)/%f#L%l-%L" \
65 --piwik-tracker "pratchett.info.uqam.ca/piwik/" \
66 --piwik-site-id "2" \
67
68 doc/nitc/index.html: bin/nitdoc bin/nitls
69 bin/nitdoc lib src/nit*.nit src/test_*.nit -d doc/nitc \
70 --private \
71 --custom-title "Nit Compilers and Tools" \
72 --custom-brand "<a href=\"http://nitlanguage.org/\">Nitlanguage.org</a>" \
73 --custom-overview-text "<p>Documentation for the Nit tools<br/>Version $$(git describe)<br/>Date: $$(git show --format="%cd" | head -1)</p>" \
74 --custom-footer-text "Nit tools. Version $$(git describe)." \
75 --github-upstream "nitlang:nit:master" \
76 --github-base-sha1 "$$(git rev-parse HEAD)" \
77 --github-gitdir "." \
78 --source "https://github.com/nitlang/nit/blob/$$(git rev-parse HEAD)/%f#L%l-%L" \
79 --piwik-tracker "pratchett.info.uqam.ca/piwik/" \
80 --piwik-site-id "3"
81
82 man:
83 # Setup PATH to find nitc
84 PATH=$$PWD/bin:$$PATH $(MAKE) -C share/man
85
86 clean:
87 rm -rf -- doc/stdlib doc/nitc || true
88 cd c_src; make clean
89 cd src; make clean
90 cd tests; make clean
91 cd share/man; make clean
92 for directory in $(extras); do \
93 (cd "$$directory" && $(MAKE) clean); \
94 done