version: update to 20190114
[SLOF.git] / Makefile
1 # *****************************************************************************
2 # * Copyright (c) 2004, 2008 IBM Corporation
3 # * All rights reserved.
4 # * This program and the accompanying materials
5 # * are made available under the terms of the BSD License
6 # * which accompanies this distribution, and is available at
7 # * http://www.opensource.org/licenses/bsd-license.php
8 # *
9 # * Contributors:
10 # * IBM Corporation - initial implementation
11 # ****************************************************************************/
12
13 include make.rules
14
15 STD_BOARDS = $(shell targets=""; \
16 for a in `echo board-*`; do \
17 if [ -e $$a/config ]; then \
18 targets="$$targets $$a"; \
19 else \
20 cd $$a; \
21 for b in `echo config* | sed -e s/config.//g`; do \
22 if [ "X$$b" != "Xsimics" ]; then \
23 if [ "X$$b" != "X`echo $$a|sed -e s/board-//g`" ]; then \
24 targets="$$targets $$a-$$b"; \
25 else \
26 targets="$$targets $$b"; \
27 fi fi \
28 done; \
29 cd ..; \
30 fi; \
31 done; \
32 echo $$targets | sed -e s/board-//g)
33
34 all:
35 @if [ ! -f .target ]; then \
36 echo "Please specify a build target:"; \
37 echo " $(STD_BOARDS)"; \
38 exit 1; \
39 fi
40 @$(MAKE) `cat .target`
41
42 rom:
43 @echo "******* Build $(BOARD) System ********"
44 @echo $(BOARD) > .target
45 @$(MAKE) -C board-$(BOARD)
46 @$(RM) -f .crc_flash
47 rw:
48 @echo "******* Build $(BOARD) system (RISCWatch boot) ********"
49 @echo $(BOARD) > .target
50 @$(MAKE) -C board-$(BOARD) l2b
51 @$(RM) -f .crc_flash
52
53 $(STD_BOARDS):
54 @echo "******** Building $@ system ********"
55 @if [ -f .target ]; then \
56 if [ `cat .target` != $@ ]; then \
57 echo "Configuration changed - cleaning up first..."; \
58 $(MAKE) distclean; \
59 echo $@ > .target; \
60 fi; \
61 else \
62 echo $@ > .target; \
63 fi
64 @b=`echo $@ | grep "-"`; \
65 if [ -n "$$b" ]; then \
66 subboard=$${b##*-}; \
67 board=$${b%%-*}; \
68 $(MAKE) -C board-$$board SUBBOARD=$$subboard; \
69 else \
70 $(MAKE) -C board-$@; \
71 fi
72 @$(RM) .crc_flash
73
74 test_all:
75 @for i in $(STD_BOARDS); do $(MAKE) distclean $$i; done
76
77 driver:
78 @echo "******** Building $(BOARD) system ********"
79 @b=`echo $(BOARD) | grep "-"`; \
80 if [ -n "$$b" ]; then \
81 subboard=$${b##*-}; \
82 board=$${b%%-*}; \
83 DRIVER=1 $(MAKE) -C board-$$board SUBBOARD=$$subboard driver; \
84 else \
85 DRIVER=1 $(MAKE) -C board-$(BOARD) driver; \
86 fi
87 @$(RM) -f .crc_flash .boot_xdr.ffs
88
89 cli:
90 $(MAKE) -C clients
91
92 # Rules for making clean:
93 clean_here:
94 $(RM) boot_rom.bin .boot_rom.ffs boot_xdr.bin .boot_xdr.ffs
95 $(RM) boot_l2-dd2.ad boot_l2b.bin .crc_flash
96
97
98 clean: clean_here
99 @if [ -e .target ]; then \
100 tar=`cat .target`; \
101 b=`echo $$tar | grep "-"`; \
102 if [ -n "$$b" ]; then \
103 subboard=$${b##*-}; \
104 board=$${b%%-*}; \
105 $(MAKE) -C board-$$board SUBBOARD=$$subboard clean; \
106 else \
107 pwd; \
108 $(MAKE) -C board-$$tar clean; \
109 fi \
110 fi
111
112 distclean: clean_here
113 @if [ -e .target ]; then \
114 tar=`cat .target`; \
115 b=`echo $$tar | grep "-"`; \
116 if [ -n "$$b" ]; then \
117 subboard=$${b##*-}; \
118 board=$${b%%-*}; \
119 $(MAKE) -C board-$$board SUBBOARD=$$subboard distclean; \
120 else \
121 $(MAKE) -C board-$$tar distclean; \
122 fi; \
123 $(RM) .target; \
124 fi
125
126 distclean_all: clean_here
127 @for dir in board-* ; do \
128 $(MAKE) -C $$dir distclean || exit 1; \
129 done
130 $(RM) .target
131
132 cli-clean:
133 $(MAKE) -C clients clean