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"
7 # N is the number of CPUs on your machine, for parallel builds)
8 # MPIFLAGS passes options to MeP-Integrator
10 # This script requires GNU make and must be invoked the top of your
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})
23 echo 'turning on Toshiba sim api (cmodel) mode'
24 ./utils/mep/MeP-Integrator -v ${MPIFLAGS} -s ${srcdir} ${MEP_CONFIG}
26 ./utils/mep/MeP-Integrator -v -s ${srcdir} ${MEP_CONFIG}
29 echo ${MEP_CONFIG} > mep-config-stmp
31 ifneq (${MEP_CONFIG},)
32 ifneq (${MEP_CONFIG},$(shell cat mep-config-stmp))
33 mep-config-stmp: force
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); \
45 mep-reconfig-opcodes: configure-opcodes
46 -rm -f opcodes/stamp-mep
48 if test -f $${dir}/Makefile; then \
50 s=`cd $(srcdir); pwd`; export s; \
52 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) stamp-mep); \
57 mep-reconfig-sid: configure-sid
58 @dir=sid/component/cgen-cpu/mep; \
59 if test -f $${dir}/Makefile; then \
61 s=`cd $(srcdir); pwd`; export s; \
63 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) cgen-all); \
68 mep-reconfig-gcc: configure-gcc
70 if test -f $${dir}/Makefile; then \
72 s=`cd $(srcdir); pwd`; export s; \
74 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) cgen-maint); \
80 .PHONY: mep-rebuild mep-rebuild-gcc mep-rebuild-target-libgloss
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
86 if [ -f ./$${dir}/Makefile ] ; then \
88 s=`cd $(srcdir); pwd`; export s; \
90 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) start.encap); \
91 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) gcc-cross); \
95 mep-rebuild-target-libgloss: mep-rebuild-gcc mep-reconfig-target-libgloss
97 if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
99 s=`cd $(srcdir); pwd`; export s; \
101 (cd $(TARGET_SUBDIR)/$${dir}; \
102 $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
107 .PHONY: mep-reinstall mep-reinstall-gcc mep-reinstall-gdb mep-reinstall-sid mep-reinstall-utils
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
114 if [ -f ./$${dir}/Makefile ] ; then \
116 s=`cd $(srcdir); pwd`; export s; \
118 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install-common install-driver); \
122 mep-reinstall-gdb: installdirs all-gdb
124 if [ -f ./$${dir}/Makefile ] ; then \
126 s=`cd $(srcdir); pwd`; export s; \
128 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
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 \
136 s=`cd $(srcdir); pwd`; export s; \
138 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
144 mep-reinstall-utils: installdirs configure-utils
146 if [ -f ./$${dir}/Makefile ] ; then \
148 s=`cd $(srcdir); pwd`; export s; \
150 (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
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
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
168 install-opcodes: all-opcodes
172 install-binutils: all-binutils
173 install-gprof: all-gprof
174 install-target-libgloss: mep-rebuild-target-libgloss