source: mainline/uspace/Makefile@ dfeb4e2

Last change on this file since dfeb4e2 was dfeb4e2, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 8 years ago

Integrate ports into the main tree as a submodule.

A stripped down version of hsct.sh is added to tools, and Makefiles
gain new targets that implement part of hsct's prior functionality.

This arrangement improves usability and maintainability of ports,
reduces the likelihood of ports being broken by mainline changes,
and partially solves the issue with build logic being duplicated
in multiple places.

It is newly possible to build individual ports using make ports-NAME,
and all ports using make ports-all. This also installs the outputs to
uspace/dist, so ideally, simple make ports-all && make would create
an image with all ports included. This currently doesn't work only
because some ports fail to build.

  • Property mode set to 100644
File size: 8.9 KB
Line 
1#
2# Copyright (c) 2005 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-include ../Makefile.common
30-include ../Makefile.config
31
32## Common binaries
33#
34
35DIRS = \
36 app/barber \
37 app/bdsh \
38 app/bithenge \
39 app/blkdump \
40 app/bnchmark \
41 app/corecfg \
42 app/devctl \
43 app/dnscfg \
44 app/dnsres \
45 app/download \
46 app/edit \
47 app/fdisk \
48 app/fontviewer \
49 app/getterm \
50 app/gunzip \
51 app/init \
52 app/inet \
53 app/kill \
54 app/killall \
55 app/kio \
56 app/loc \
57 app/logset \
58 app/mixerctl \
59 app/mkfat \
60 app/mkexfat \
61 app/mkmfs \
62 app/modplay \
63 app/netecho \
64 app/nterm \
65 app/redir \
66 app/rcutest \
67 app/rcubench \
68 app/sbi \
69 app/sportdmp \
70 app/stats \
71 app/taskdump \
72 app/tester \
73 app/testread \
74 app/testwrit \
75 app/tetris \
76 app/trace \
77 app/top \
78 app/untar \
79 app/usbinfo \
80 app/vuhid \
81 app/nic \
82 app/ping \
83 app/pkg \
84 app/sysinfo \
85 app/sysinst \
86 app/mkbd \
87 app/date \
88 app/vcalc \
89 app/vdemo \
90 app/viewer \
91 app/vlaunch \
92 app/vterm \
93 app/df \
94 app/wavplay \
95 app/websrv \
96 app/wifi_supplicant \
97 srv/audio/hound \
98 srv/clipboard \
99 srv/locsrv \
100 srv/logger \
101 srv/klog \
102 srv/devman \
103 srv/loader \
104 srv/net/dhcp \
105 srv/net/dnsrsrv \
106 srv/net/ethip \
107 srv/net/inetsrv \
108 srv/net/loopip \
109 srv/net/nconfsrv \
110 srv/net/slip \
111 srv/net/tcp \
112 srv/net/udp \
113 srv/ns \
114 srv/taskmon \
115 srv/vfs \
116 srv/bd/sata_bd \
117 srv/bd/file_bd \
118 srv/bd/rd \
119 srv/bd/vbd \
120 srv/fs/exfat \
121 srv/fs/udf \
122 srv/fs/fat \
123 srv/fs/cdfs \
124 srv/fs/tmpfs \
125 srv/fs/mfs \
126 srv/fs/locfs \
127 srv/fs/ext4fs \
128 srv/volsrv \
129 srv/hid/compositor \
130 srv/hid/console \
131 srv/hid/s3c24xx_ts \
132 srv/hid/isdv4_tablet \
133 srv/hid/input \
134 srv/hid/output \
135 srv/hid/remcons \
136 srv/hw/char/s3c24xx_uart \
137 srv/hid/rfb \
138 srv/test/chardev-test \
139 drv/audio/hdaudio \
140 drv/audio/sb16 \
141 drv/root/root \
142 drv/root/virt \
143 drv/block/ahci \
144 drv/block/ata_bd \
145 drv/block/ddisk \
146 drv/block/usbmast \
147 drv/bus/adb/cuda_adb \
148 drv/bus/isa \
149 drv/bus/pci/pciintel \
150 drv/bus/usb/ehci \
151 drv/bus/usb/ohci \
152 drv/bus/usb/uhci \
153 drv/bus/usb/usbflbk \
154 drv/bus/usb/usbhub \
155 drv/bus/usb/usbmid \
156 drv/bus/usb/vhc \
157 drv/char/i8042 \
158 drv/char/msim-con \
159 drv/char/ns8250 \
160 drv/char/pl050 \
161 drv/char/ski-con \
162 drv/char/sun4v-con \
163 drv/fb/amdm37x_dispc \
164 drv/fb/kfb \
165 drv/hid/adb-kbd \
166 drv/hid/adb-mouse \
167 drv/hid/atkbd \
168 drv/hid/ps2mouse \
169 drv/hid/usbhid \
170 drv/hid/xtkbd \
171 drv/intctl/apic \
172 drv/intctl/i8259 \
173 drv/intctl/icp-ic \
174 drv/intctl/obio \
175 drv/nic/ne2k \
176 drv/nic/e1k \
177 drv/nic/rtl8139 \
178 drv/nic/rtl8169 \
179 drv/nic/ar9271 \
180 drv/platform/amdm37x \
181 drv/platform/icp \
182 drv/platform/mac \
183 drv/platform/malta \
184 drv/platform/msim \
185 drv/platform/pc \
186 drv/platform/ski \
187 drv/platform/sun4v \
188 drv/test/test1 \
189 drv/test/test2 \
190 drv/test/test3 \
191 drv/time/cmos-rtc
192
193## sun4u driver won't compile on 32-bit targets
194ifeq ($(UARCH),sparc64)
195 DIRS += \
196 drv/platform/sun4u
197endif
198
199## Dynamic linking tests
200#
201ifeq ($(CONFIG_BUILD_SHARED_LIBS),y)
202 DIRS += \
203 app/dltest \
204 app/dltests
205endif
206
207## System libraries
208#
209
210BASE_LIBS = \
211 lib/c \
212 lib/softint \
213 lib/softfloat
214
215LIBS = \
216 lib/fs \
217 lib/block \
218 lib/crypto \
219 lib/clui \
220 lib/dltest \
221 lib/fdisk \
222 lib/fmtutil \
223 lib/scsi \
224 lib/compress \
225 lib/drv \
226 lib/graph \
227 lib/gui \
228 lib/hound \
229 lib/http \
230 lib/softrend \
231 lib/draw \
232 lib/label \
233 lib/math \
234 lib/minix \
235 lib/nettl \
236 lib/nic \
237 lib/ext4 \
238 lib/trackmod \
239 lib/uri \
240 lib/usb \
241 lib/usbhost \
242 lib/usbdev \
243 lib/usbhid \
244 lib/usbvirt \
245 lib/pcm \
246 lib/pcut \
247 lib/bithenge \
248 lib/posix \
249 lib/ieee80211
250
251BASE_BUILDS := $(addsuffix .build,$(BASE_LIBS))
252BUILDS := $(addsuffix .build,$(DIRS) $(LIBS))
253BUILDS_TESTS := $(addsuffix .build-test,$(DIRS) $(LIBS) $(BASE_LIBS))
254DEPS = $(addsuffix /deps.mk,$(DIRS) $(LIBS))
255CLEANS := $(addsuffix .clean,$(DIRS) $(LIBS) $(BASE_LIBS))
256
257PORTS_BUILD_DIR := ../build/ports
258PORT_CFLAGS := \
259 -specs $(abspath lib/posix/gcc.specs) \
260 -isystem $(abspath $(PORTS_BUILD_DIR)/include) \
261 -isystem $(abspath $(PORTS_BUILD_DIR)/include/posix) \
262 -isystem $(abspath $(PORTS_BUILD_DIR)/include/libc) \
263 -L$(abspath $(PORTS_BUILD_DIR)/lib) \
264 -Wl,-T,link.ld \
265 -Wl,--whole-archive,-lc,-lmath,--no-whole-archive
266
267.PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean ports_cache
268
269all: $(BUILDS) $(BUILDS_TESTS)
270
271ports_cache: lib/posix.build lib/math.build lib/clui.build
272 git submodule update --init -- ports
273
274 # Copy libs
275 mkdir -p $(PORTS_BUILD_DIR)/lib
276 cp lib/posix/link.ld $(PORTS_BUILD_DIR)/lib/link.ld
277 cp lib/posix/libc.a $(PORTS_BUILD_DIR)/lib/libc.a
278 # We don't currently build a dedicated debug-enabled libc version.
279 cp lib/posix/libc.a $(PORTS_BUILD_DIR)/lib/libg.a
280 cp lib/math/libmath.a $(PORTS_BUILD_DIR)/lib/libmath.a
281 cp lib/clui/libclui.a $(PORTS_BUILD_DIR)/lib/libclui.a
282
283 # Copy headers
284 mkdir -p $(PORTS_BUILD_DIR)/include
285 cp -L -R lib/posix/include/posix/ $(PORTS_BUILD_DIR)/include/
286 mkdir -p $(PORTS_BUILD_DIR)/include/libc
287 cp -L -R lib/c/include/* $(PORTS_BUILD_DIR)/include/libc
288 cp -L -R lib/c/arch/$(UARCH)/include/libarch $(PORTS_BUILD_DIR)/include/
289 cp -L -R lib/math/include/* $(PORTS_BUILD_DIR)/include/libc
290 cp -L -R lib/math/arch/$(UARCH)/include/libarch/ $(PORTS_BUILD_DIR)/include/
291 cp -L -R ../abi/include/* $(PORTS_BUILD_DIR)/include/
292 ln -s -f -n libc $(PORTS_BUILD_DIR)/include/libmath
293
294 # FIXME: Just for temporary compatibility.
295 touch $(PORTS_BUILD_DIR)/coastline.specs
296
297 mkdir -p $(PORTS_BUILD_DIR)/include/libclui
298 cp -L lib/clui/tinput.h $(PORTS_BUILD_DIR)/include/libclui/
299
300 # TODO: Get rid of this.
301 find $(PORTS_BUILD_DIR)/include/libc $(PORTS_BUILD_DIR)/include/libarch -name '*.h' -exec sed \
302 -e 's:#include <:#include <libc/:' \
303 -e 's:#include <libc/libarch/:#include <libarch/:' \
304 -e 's:#include <libc/abi/:#include <abi/:' \
305 -e 's:#include <libc/_bits/:#include <_bits/:' \
306 -e 's:#include <libc/libc/:#include <libc/:' \
307 -i {} \;
308
309 mkdir -p overlay
310
311ports-all: ports_cache
312 for x in ports/*; do if [ -d "$$x" ]; then $(MAKE) ports-install-`basename $$x` || exit 1; fi; done
313
314ports-%: ports_cache
315 $(MAKE) $(@:ports-%=ports-install-%)
316
317# This is a separate target to avoid running ports_cache multiple times.
318ports-install-%:
319 PATH="$(CROSS_PREFIX)/$(TARGET)/bin:$$PATH" \
320 HSCT_HELENOS_ROOT="$(abspath ..)" \
321 HSCT_HOME="$(abspath ports)" \
322 HSCT_HSCT="$(abspath ../tools/hsct.sh)" \
323 HSCT_SOURCES_DIR="$(abspath $(PORTS_BUILD_DIR)/sources)" \
324 HSCT_BUILD_DIR="$(abspath $(PORTS_BUILD_DIR)/build)" \
325 HSCT_INCLUDE_DIR="$(abspath $(PORTS_BUILD_DIR)/include)" \
326 HSCT_LIB_DIR="$(abspath $(PORTS_BUILD_DIR)/lib)" \
327 HSCT_CACHE_DIR="$(abspath $(PORTS_BUILD_DIR))" \
328 HSCT_CACHE_LIB="$(abspath $(PORTS_BUILD_DIR)/lib)" \
329 HSCT_DIST_DIR="$(abspath $(PORTS_BUILD_DIR)/dist)" \
330 HSCT_ARCHIVE_DIR="$(abspath $(PORTS_BUILD_DIR)/archives)" \
331 HSCT_PARALLELISM="$(JOBS)" \
332 HSCT_GNU_TARGET="$(TARGET)" \
333 HSCT_CC="$(CC) $(PORT_CFLAGS)" \
334 HSCT_CFLAGS="" \
335 HSCT_LDFLAGS_FOR_CC="" \
336 HSCT_LD="$(LD)" \
337 HSCT_AR="$(AR)" \
338 HSCT_RANLIB="$(RANLIB)" \
339 HSCT_OBJDUMP="$(OBJDUMP)" \
340 HSCT_OBJCOPY="$(OBJCOPY)" \
341 HSCT_AS="$(AS)" \
342 HSCT_STRIP="$(STRIP)" \
343 ../tools/hsct.sh install $(@:ports-install-%=%)
344
345$(BUILDS_TESTS): $(BASE_BUILDS) $(BUILDS)
346 $(MAKE) -r -C $(basename $@) all-test PRECHECK=$(PRECHECK)
347
348clean: $(CLEANS)
349 find lib app drv srv -name '*.o' -follow -exec rm \{\} \;
350 find lib app drv srv -name '*.lo' -follow -exec rm \{\} \;
351 find lib app drv srv -name '*.d' -follow -exec rm \{\} \;
352
353$(CLEANS):
354 -$(MAKE) -r -C $(basename $@) fasterclean
355
356$(BASE_BUILDS) $(BUILDS):
357 $(MAKE) -r -C $(basename $@) all PRECHECK=$(PRECHECK)
358
359$(DEPS): %/deps.mk: %/Makefile
360 $(MAKE) -r -C $(@D) deps.mk SELF_TARGET="$(@D).build"
361
362# Special case for base libraries.
363lib/c.build: lib/softfloat.build lib/softint.build
364
365$(BUILDS): $(BASE_BUILDS)
366
367-include $(DEPS)
368
Note: See TracBrowser for help on using the repository browser.