OSDN Git Service

Remove some scaffolding which was inadvertently commited.
[pf3gnuchains/sourceware.git] / utils / mep / rebuild.mk
1 #! /usr/bin/make -f
2
3 # To reconfigure the MeP toolchain and rebuild those bits that require
4 # rebuilding, run this script as follows
5 # ./rebuild.mk -jN [MPIFLAGS=] MEP_CONFIG="file1.cfg file2.cfg"
6 # Where:
7 #  N is the number of CPUs on your machine, for parallel builds)
8 #  MPIFLAGS passes options to MeP-Integrator
9
10 # This script requires GNU make and must be invoked the top of your
11 # build directory.
12
13 mep-reinstall:
14
15 include Makefile
16
17 .PHONY: mep-reconfig
18 mep-reconfig: mep-reconfig-sid \
19   mep-reconfig-gcc mep-reconfig-opcodes mep-reconfig-target-libgloss 
20 mep-config-stmp: utils/mep/MeP-Integrator ${MEP_CONFIG}
21 ifneq (,${MEP_CONFIG})
22 ifdef MPIFLAGS
23         echo 'turning on Toshiba sim api (cmodel) mode'
24         ./utils/mep/MeP-Integrator -v ${MPIFLAGS} -s ${srcdir} ${MEP_CONFIG}
25 else
26         ./utils/mep/MeP-Integrator -v -s ${srcdir} ${MEP_CONFIG}
27 endif
28 endif
29         echo ${MEP_CONFIG} > mep-config-stmp
30
31 ifneq (${MEP_CONFIG},)
32 ifneq (${MEP_CONFIG},$(shell cat mep-config-stmp))
33 mep-config-stmp: force
34 force:
35 endif
36 endif
37
38 mep-reconfig-target-libgloss: mep-config-stmp
39         if test -f $(TARGET_SUBDIR)/libgloss/config.status; then \
40           (cd $(TARGET_SUBDIR)/libgloss && $(SHELL) ./config.status); \
41           touch $@; \
42         else \
43           true; \
44         fi
45 mep-reconfig-opcodes: configure-opcodes
46         -rm -f opcodes/stamp-mep
47         @dir=opcodes; \
48         if test -f $${dir}/Makefile; then \
49           r=`pwd`; export r; \
50           s=`cd $(srcdir); pwd`; export s; \
51           $(SET_LIB_PATH) \
52           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) stamp-mep); \
53           touch $@; \
54         else \
55           true; \
56         fi
57 mep-reconfig-sid: configure-sid
58         @dir=sid/component/cgen-cpu/mep; \
59         if test -f $${dir}/Makefile; then \
60           r=`pwd`; export r; \
61           s=`cd $(srcdir); pwd`; export s; \
62           $(SET_LIB_PATH) \
63           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) cgen-all); \
64           touch $@; \
65         else \
66           true; \
67         fi
68 mep-reconfig-gcc: configure-gcc
69         @dir=gcc; \
70         if test -f $${dir}/Makefile; then \
71           r=`pwd`; export r; \
72           s=`cd $(srcdir); pwd`; export s; \
73           $(SET_LIB_PATH) \
74           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) cgen-maint); \
75           touch $@; \
76         else \
77           true; \
78         fi
79
80 .PHONY: mep-rebuild mep-rebuild-gcc mep-rebuild-target-libgloss
81 mep-rebuild: \
82   all-gdb all-sid mep-rebuild-gcc mep-rebuild-target-libgloss \
83   all-opcodes all-bfd all-gprof
84 mep-rebuild-gcc: all-binutils all-gas all-ld mep-reconfig-gcc
85         @dir=gcc; \
86         if [ -f ./$${dir}/Makefile ] ; then \
87           r=`pwd`; export r; \
88           s=`cd $(srcdir); pwd`; export s; \
89           $(SET_LIB_PATH) \
90           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) start.encap); \
91           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) gcc-cross); \
92         else \
93           true; \
94         fi
95 mep-rebuild-target-libgloss: mep-rebuild-gcc mep-reconfig-target-libgloss
96         @dir=libgloss; \
97         if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
98           r=`pwd`; export r; \
99           s=`cd $(srcdir); pwd`; export s; \
100           $(SET_LIB_PATH) \
101           (cd $(TARGET_SUBDIR)/$${dir}; \
102             $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
103         else \
104           true; \
105         fi
106
107 .PHONY: mep-reinstall mep-reinstall-gcc mep-reinstall-gdb mep-reinstall-sid mep-reinstall-utils
108 mep-reinstall: \
109   mep-reinstall-sid mep-reinstall-gcc mep-reinstall-gdb \
110   install-gas install-ld install-binutils install-gprof \
111   install-target-libgloss mep-reinstall-utils
112 mep-reinstall-gcc: installdirs mep-rebuild-gcc
113         @dir=gcc; \
114         if [ -f ./$${dir}/Makefile ] ; then \
115           r=`pwd`; export r; \
116           s=`cd $(srcdir); pwd`; export s; \
117           $(SET_LIB_PATH) \
118           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install-common install-driver); \
119         else \
120           true; \
121         fi
122 mep-reinstall-gdb: installdirs all-gdb
123         @dir=gdb; \
124         if [ -f ./$${dir}/Makefile ] ; then \
125           r=`pwd`; export r; \
126           s=`cd $(srcdir); pwd`; export s; \
127           $(SET_LIB_PATH) \
128           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
129         else \
130           true; \
131         fi
132 mep-reinstall-sid: installdirs all-sid
133         @for dir in sid/main/dynamic sid/component/cgen-cpu sid/component/families/mep; do \
134           if [ -f ./$${dir}/Makefile ] ; then \
135             r=`pwd`; export r; \
136             s=`cd $(srcdir); pwd`; export s; \
137             $(SET_LIB_PATH) \
138             (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
139           else \
140             true; \
141           fi \
142         done
143
144 mep-reinstall-utils: installdirs configure-utils
145         @dir=utils/mep; \
146         if [ -f ./$${dir}/Makefile ] ; then \
147           r=`pwd`; export r; \
148           s=`cd $(srcdir); pwd`; export s; \
149           $(SET_LIB_PATH) \
150           (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
151         else \
152           true; \
153         fi
154
155 # Additional rules for parallel make
156 configure-opcodes: mep-config-stmp
157 configure-sid: mep-config-stmp
158 configure-gcc: mep-config-stmp
159 configure-utils: mep-config-stmp
160
161 all-binutils: mep-reconfig-opcodes
162 all-gas: mep-reconfig-opcodes
163 all-ld: mep-reconfig-opcodes
164 all-opcodes: mep-reconfig-opcodes
165 all-gdb: configure-gdb all-sid
166 all-sid: mep-reconfig-sid mep-reconfig-opcodes
167
168 install-opcodes: all-opcodes
169 install-gas: all-gas
170 install-ld: all-ld
171 install-bfd: all-bfd
172 install-binutils: all-binutils
173 install-gprof: all-gprof
174 install-target-libgloss: mep-rebuild-target-libgloss