-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
268 lines (201 loc) · 6.93 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
### ==========================================================================
### $Id: Makefile 886 2009-04-21 13:00:15Z hoenicke $
### FILE: Makefile - make all parts of the bibo distribution
### bibo - another LEGO Mindstorms OS
### --------------------------------------------------------------------------
### (This is the top-level Makefile. All actions are performed from here)
# org and distribution names (all lowercase by convention)
ORG = brickbot
PACKAGE = bibo
# version of this release
VERSION = 0.05
# kernel used (w/o extension)
KERNEL=kernel/$(PACKAGE)
# ------------------------------------------------------------
# No user customization below here...
# ------------------------------------------------------------
#
# makefile to build the brickOS operating system and demo files
#
SUBDIRS=util lib include kernel xs
# Only build the demo programs if program support is enabled
ifeq ($(shell grep --quiet '^\#define CONF_PROGRAM' include/config.h && echo 1),1)
SUBDIRS += demo
else
$(info NOTE: CONF_PROGRAM support for programs disabled; skipping building of demo programs)
endif
# Add docs to the subdirs list last
SUBDIRS += doc
all::
include Makefile.common
include $(SUBDIRS:%=%/Makefile.sub)
install::
test -d $(DESTDIR)$(pkgdatadir) || mkdir -p $(DESTDIR)$(pkgdatadir)
install -m 644 Makefile.user $(DESTDIR)$(pkgdatadir)
sed -e '/installation paths/a \
PACKAGE = $(PACKAGE)\
BINDIR = $(bindir)\
DATADIR = $(pkgdatadir)\
LIBDIR = $(pkglibdir)\
INCLUDEDIR = $(pkgincludedir)\
CROSSTOOLPREFIX = $(CROSSTOOLPREFIX)'\
< Makefile.dist > $(DESTDIR)$(pkgdatadir)/Makefile
chmod 644 $(DESTDIR)$(pkgdatadir)/Makefile
realclean:: clean
rm -f tags TAGS *.bak Makefile.config *~ *.bak
docs-build docs-install::
$(MAKE) $(MFLAGS) -C doc $@
# API generation support using Doxygen
#
# when we get a new version of doxygen, run this target once
#
upgrade-doxygen:
doxygen -u Doxyfile-c
doxygen -u Doxyfile-c++
doxygen -u Doxyfile
#
# doc/html-c subdirectory: make C docs
#
html-c: Doxyfile-c-report
realclean::
rm -rf doc/html-c doc/rtf-c
rm -f -- Doxyfile-c.log Doxyfile-c.rpt .Doxyfile-c-doneflag *.out
brickos-html-c-dist.tar.gz: html-c
cd doc;tar --gzip -cf $@ html-c;mv $@ ..;cd -
html-c-dist: brickos-html-c-dist.tar.gz
html-c-install: html-c
cp -r doc/html-c ${pkghtmldir}
Doxyfile-c.log: Doxyfile-c
doxygen $? >$@ 2>&1
Doxyfile-c.rpt: Doxyfile-c.log
@grep Warn $? | sed -e 's/^.*brickos\///' | cut -f1 -d: | sort | \
uniq -c | sort -rn | tee $@
.Doxyfile-c-doneflag: Doxyfile-c.rpt
@for FIL in `cat $? | cut -c9-99`; do \
OUTFILE=`echo $$FIL | sed -e 's/[\/\.]/-/g'`.out; \
echo "# FILE: $$OUTFILE" >$$OUTFILE; \
grep "$$FIL" $? >>$$OUTFILE; \
grep "$$FIL" Doxyfile-c.log | grep Warn >>$$OUTFILE; \
done
@touch $@
Doxyfile-c-report: .Doxyfile-c-doneflag
-ls -ltr *.out 2>/dev/null
#
# doc/html-c++ subdirectory: make C++ docs
#
html-c++: Doxyfile-c++-report
realclean::
rm -rf doc/html-c++ doc/rtf-c++
rm -f -- Doxyfile-c++.log Doxyfile-c++.rpt .Doxyfile-c++-doneflag *.out
brickos-html-c++-dist.tar.gz: html-c++
cd doc;tar --gzip -cf $@ html-c++;mv $@ ..;cd -
html-c++-dist: brickos-html-c++-dist.tar.gz
html-c++-install: html-c++
cp -r doc/html-c++ ${pkghtmldir}
Doxyfile-c++.log:
doxygen Doxyfile-c++ >$@ 2>&1
Doxyfile-c++.rpt: Doxyfile-c++.log
@grep Warn $? | sed -e 's/^.*brickos\///' | cut -f1 -d: | sort | \
uniq -c | sort -rn | tee $@
.Doxyfile-c++-doneflag: Doxyfile-c++.rpt
@for FIL in `cat Doxyfile-c++.rpt | cut -c9-99`; do \
OUTFILE=`echo $$FIL | sed -e 's/[\/\.]/-/g'`.out; \
echo "# FILE: $$OUTFILE" >$$OUTFILE; \
grep "$$FIL" Doxyfile-c++.rpt >>$$OUTFILE; \
grep "$$FIL" Doxyfile-c++.log | grep Warn >>$$OUTFILE; \
done
@touch $@
Doxyfile-c++-report: .Doxyfile-c++-doneflag
-ls -ltr *.out 2>/dev/null
#
# doc/html-kern subdirectory: make kernel developer docs
#
html-kern: Doxyfile-kern-report
realclean::
rm -rf doc/html-kern doc/rtf-kern
rm -f -- Doxyfile-kern.log Doxyfile-kern.rpt .Doxyfile-kern-doneflag *.out
brickos-html-kern-dist.tar.gz: html-kern
cd doc;tar --gzip -cf $@ html-kern;mv $@ ..;cd -
html-kern-dist: brickos-html-kern-dist.tar.gz
html-kern-install: html-kern
cp -r doc/html-kern ${pkghtmldir}
Doxyfile-kern.log:
doxygen Doxyfile >$@ 2>&1
Doxyfile-kern.rpt: Doxyfile-kern.log
@grep Warn $? | sed -e 's/^.*brickos\///' | cut -f1 -d: | sort | \
uniq -c | sort -rn | tee $@
.Doxyfile-kern-doneflag: Doxyfile-kern.rpt
@for FIL in `cat Doxyfile-kern.rpt | cut -c9-99`; do \
OUTFILE=`echo $$FIL | sed -e 's/[\/\.]/-/g'`.out; \
echo "# FILE: $$OUTFILE" >$$OUTFILE; \
grep "$$FIL" Doxyfile-kern.rpt >>$$OUTFILE; \
grep "$$FIL" Doxyfile-kern.log | grep Warn >>$$OUTFILE; \
done
@touch $@
Doxyfile-kern-report: .Doxyfile-kern-doneflag
-ls -ltr *.out 2>/dev/null
#
# make all API documentation
#
api-docs-build: html-c html-c++ html-kern
docs: docs-build api-docs-build
#
# make distribution files for all API documentation
#
api-dist: html-c-dist html-c++-dist html-kern-dist
#
# install all API documentation
#
docs-install:: html-c-install html-c++-install html-kern-install
# NOTE: --format=1 is not supported on Linux ([ce]tags in emacs2[01] packages)
# please set in your own environment
tag::
-ctags kernel/*.c include/*.h include/*/*.h
-etags kernel/*.c include/*.h include/*/*.h
.PHONY: all depend tag clean realclean html tag c++ html html-c html-c++ html-kern html-dist
# ------------------------------------------------------------
# Components of this release to be packaged
# ------------------------------------------------------------
#
DISTFILES += Doxyfile Doxyfile-c Doxyfile-c++ $(PACKAGE).ld configure \
README CONTRIBUTORS LICENSE \
Makefile Makefile.common Makefile.dist Makefile.user
# locations for this package build effort
DISTDIR = $(PACKAGE)-$(VERSION)
# tools we use to make distribution image
TAR = tar
GZIP_ENV = --best
DISTDISTFILES = $(DISTFILES:%=$(DISTDIR)/%)
# make our distribution tarball
dist: distclean $(DISTDISTFILES)
GZIP=$(GZIP_ENV) $(TAR) chozf $(DISTDIR).tar.gz $(DISTDIR)
@echo "---------------------------------------------------------"
@echo " MD5 sum for $(PACKAGE) v$(VERSION)"
@md5sum $(DISTDIR).tar.gz
@echo "---------------------------------------------------------"
distclean:
rm -rf $(DISTDIR)
# build a copy of the source tree which can be zipped up and then deleted
$(DISTDISTFILES): $(DISTDIR)/%: %
@echo $@
@mkdir -p $(dir $@)
@cp -p $< $@
#
# install makefiles
#
uninstall::
rm -rf ${pkglibdir} ${pkgincludedir} ${pkgdocdir}
clean::
rm -f Makefile.user.dist Makefile.common.dist demo/Makefile.dist demo/c++/Makefile.dist config.h.dist
###
### generic rules
###
# cancel standard C source rule
%.o: %.c
# how to compile native C source
$(NATIVEOBJS): %.o: %.c
$(CC) -MMD $(CFLAGS) -c $< -o $@
# how to build srec from coff (for download)
%.srec: %.coff
$(CROSSOBJCOPY) -I coff-h8300 -O srec $*.coff $*.srec
include Makefile.user