[444] | 1 | # Copyright (c) 2012 ARM Ltd. All rights reserved. |
---|
| 2 | # |
---|
| 3 | # Redistribution and use in source and binary forms, with or without |
---|
| 4 | # modification, are permitted provided that the following conditions |
---|
| 5 | # are met: |
---|
| 6 | # 1. Redistributions of source code must retain the above copyright |
---|
| 7 | # notice, this list of conditions and the following disclaimer. |
---|
| 8 | # 2. Redistributions in binary form must reproduce the above copyright |
---|
| 9 | # notice, this list of conditions and the following disclaimer in the |
---|
| 10 | # documentation and/or other materials provided with the distribution. |
---|
| 11 | # 3. The name of the company may not be used to endorse or promote |
---|
| 12 | # products derived from this software without specific prior written |
---|
| 13 | # permission. |
---|
| 14 | # |
---|
| 15 | # THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
| 16 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
| 17 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
---|
| 18 | # IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 19 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
---|
| 20 | # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
| 21 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
| 22 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
| 23 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
| 24 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 25 | |
---|
| 26 | DESTDIR = |
---|
| 27 | VPATH = @srcdir@ @srcdir@/.. |
---|
| 28 | srcdir = @srcdir@ |
---|
| 29 | objdir = . |
---|
| 30 | srcroot = $(srcdir)/../.. |
---|
| 31 | objroot = $(objdir)/../.. |
---|
| 32 | |
---|
| 33 | prefix = @prefix@ |
---|
| 34 | exec_prefix = @exec_prefix@ |
---|
| 35 | |
---|
| 36 | host_alias = @host_alias@ |
---|
| 37 | target_alias = @target_alias@ |
---|
| 38 | |
---|
| 39 | bindir = @bindir@ |
---|
| 40 | libdir = @libdir@ |
---|
| 41 | tooldir = $(exec_prefix)/$(target_alias) |
---|
| 42 | |
---|
| 43 | objtype = @objtype@ |
---|
| 44 | |
---|
| 45 | INSTALL = @INSTALL@ |
---|
| 46 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
---|
| 47 | INSTALL_DATA = @INSTALL_DATA@ |
---|
| 48 | |
---|
| 49 | # Multilib support variables. |
---|
| 50 | # TOP is used instead of MULTI{BUILD,SRC}TOP. |
---|
| 51 | MULTISRCTOP = |
---|
| 52 | MULTIBUILDTOP = |
---|
| 53 | MULTIDIRS = |
---|
| 54 | MULTISUBDIR = |
---|
| 55 | MULTILIBNAME = |
---|
| 56 | MULTIDO = true |
---|
| 57 | MULTICLEAN = true |
---|
| 58 | MULTI_FLAGS_FOR_TARGET = MULTI_DEFAULT_FLAGS |
---|
| 59 | MULTI_DEFAULT_FLAGS = -DSEMIHOST_V2 |
---|
| 60 | |
---|
| 61 | SHELL = /bin/sh |
---|
| 62 | |
---|
| 63 | CC = @CC@ |
---|
| 64 | |
---|
| 65 | AS = @AS@ |
---|
| 66 | AR = @AR@ |
---|
| 67 | LD = @LD@ |
---|
| 68 | RANLIB = @RANLIB@ |
---|
| 69 | |
---|
| 70 | SUBDIRS = @subdirs@ |
---|
| 71 | |
---|
| 72 | OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ |
---|
| 73 | then echo ${objroot}/../binutils/objdump ; \ |
---|
| 74 | else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` |
---|
| 75 | OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ |
---|
| 76 | then echo ${objroot}/../binutils/objcopy ; \ |
---|
| 77 | else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` |
---|
| 78 | |
---|
| 79 | OBJS = ftruncate.o libcfunc.o syscalls.o truncate.o _exit.o _kill.o |
---|
| 80 | CRT0 = crt0.o |
---|
| 81 | CRT0_INSTALL = install-crt0 |
---|
| 82 | |
---|
| 83 | RDIMON_CRT0 = rdimon-crt0${${MULTILIBNAME}}.o |
---|
| 84 | RDIMON_BSP = librdimon${${MULTILIBNAME}}.a |
---|
| 85 | RDIMON_OBJS = $(patsubst %,rdimon-%,$(OBJS)) |
---|
| 86 | RDIMON_SCRIPTS = rdimon${${MULTILIBNAME}}.specs \ |
---|
| 87 | aem-ve${${MULTILIBNAME}}.specs \ |
---|
| 88 | aem-validation${${MULTILIBNAME}}.specs |
---|
| 89 | RDIMON_INSTALL = install-rdimon |
---|
| 90 | |
---|
| 91 | CFLAGS = -g |
---|
| 92 | |
---|
| 93 | # Host specific makefile fragment comes in here. |
---|
| 94 | @host_makefile_frag@ |
---|
| 95 | |
---|
| 96 | # |
---|
| 97 | # build a test program for each target board. Just trying to get |
---|
| 98 | # it to link is a good test, so we ignore all the errors for now. |
---|
| 99 | # |
---|
| 100 | |
---|
| 101 | all: ${CRT0} ${RDIMON_CRT0} ${RDIMON_BSP} ${RDIMON_SCRIPTS} |
---|
| 102 | @rootpre=`pwd`/; export rootpre; \ |
---|
| 103 | srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ |
---|
| 104 | for dir in .. ${SUBDIRS}; do \ |
---|
| 105 | if [ x$$dir != x.. ]; then \ |
---|
| 106 | if [ -d $$dir ]; then \ |
---|
| 107 | (cd $$dir; $(MAKE) $(FLAGS_TO_PASS)); \ |
---|
| 108 | else true; fi; \ |
---|
| 109 | else true; fi; \ |
---|
| 110 | done |
---|
| 111 | $(MAKE) $(AM_MAKEFLAGS) all-recursive |
---|
| 112 | |
---|
| 113 | # |
---|
| 114 | # here's where we build the test programs for each target |
---|
| 115 | # |
---|
| 116 | .PHONY: test |
---|
| 117 | test: |
---|
| 118 | |
---|
| 119 | # |
---|
| 120 | crt0.o: crt0.S |
---|
| 121 | $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -o $@ -c $< |
---|
| 122 | |
---|
| 123 | rdimon-crt0${${MULTILIBNAME}}.o: crt0.S |
---|
| 124 | $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< |
---|
| 125 | |
---|
| 126 | #rdimon-trap.o: trap.S |
---|
| 127 | # $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< |
---|
| 128 | |
---|
| 129 | rdimon-_exit.o: _exit.c |
---|
| 130 | $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< |
---|
| 131 | |
---|
| 132 | rdimon-ftruncate.o: ftruncate.c |
---|
| 133 | $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< |
---|
| 134 | |
---|
| 135 | rdimon-_kill.o: _kill.c |
---|
| 136 | $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< |
---|
| 137 | |
---|
| 138 | rdimon-libcfunc.o: libcfunc.c |
---|
| 139 | $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< |
---|
| 140 | |
---|
| 141 | rdimon-syscalls.o: syscalls.c |
---|
| 142 | $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< |
---|
| 143 | |
---|
| 144 | rdimon-truncate.o: truncate.c |
---|
| 145 | $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< |
---|
| 146 | |
---|
| 147 | $(RDIMON_BSP): $(RDIMON_OBJS) |
---|
| 148 | ${AR} ${ARFLAGS} $@ $^ |
---|
| 149 | ${RANLIB} $@ |
---|
| 150 | |
---|
| 151 | # Multilib support. |
---|
| 152 | .PHONY: multi-do all-multi clean-multi install-multi |
---|
| 153 | |
---|
| 154 | all-recursive: all-multi |
---|
| 155 | clean-recursive: clean-multi |
---|
| 156 | install-recursive: install-multi |
---|
| 157 | |
---|
| 158 | # The $(MAKE) comments below are to enable parallel building. |
---|
| 159 | all-multi: |
---|
| 160 | $(MAKE) $(AM_MAKEFLAGS) DO=all multi-do |
---|
| 161 | |
---|
| 162 | clean-multi: |
---|
| 163 | $(MAKE) $(AM_MAKEFLAGS) DO=clean multi-do |
---|
| 164 | |
---|
| 165 | install-multi: |
---|
| 166 | $(MAKE) $(AM_MAKEFLAGS) DO=install multi-do |
---|
| 167 | |
---|
| 168 | clean mostlyclean: |
---|
| 169 | rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) ${RDIMON_SCRIPTS} |
---|
| 170 | @rootpre=`pwd`/; export rootpre; \ |
---|
| 171 | srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ |
---|
| 172 | for dir in .. ${SUBDIRS}; do \ |
---|
| 173 | if [ x$$dir != x.. ]; then \ |
---|
| 174 | if [ -d $$dir ]; then \ |
---|
| 175 | (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) clean); \ |
---|
| 176 | else true; fi; \ |
---|
| 177 | else true; fi; \ |
---|
| 178 | done |
---|
| 179 | $(MAKE) $(AM_MAKEFLAGS) clean-recursive |
---|
| 180 | |
---|
| 181 | distclean maintainer-clean realclean: clean |
---|
| 182 | rm -f Makefile config.status *~ |
---|
| 183 | |
---|
| 184 | .PHONY: install info install-info clean-info |
---|
| 185 | install: ${CRT0_INSTALL} ${RDIMON_INSTALL} |
---|
| 186 | @rootpre=`pwd`/; export rootpre; \ |
---|
| 187 | srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ |
---|
| 188 | for dir in .. ${SUBDIRS}; do \ |
---|
| 189 | if [ x$$dir != x.. ]; then \ |
---|
| 190 | if [ -d $$dir ]; then \ |
---|
| 191 | (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) install); \ |
---|
| 192 | else true; fi; \ |
---|
| 193 | else true; fi; \ |
---|
| 194 | done |
---|
| 195 | $(MAKE) $(AM_MAKEFLAGS) install-recursive |
---|
| 196 | |
---|
| 197 | install-crt0: |
---|
| 198 | ${INSTALL_DATA} ${CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x |
---|
| 199 | |
---|
| 200 | install-rdimon: |
---|
| 201 | set -e; for x in ${RDIMON_CRT0} ${RDIMON_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done |
---|
| 202 | set -e; for x in ${RDIMON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done |
---|
| 203 | |
---|
| 204 | # Make copies of the scripts to facilitate in-tree bootstrapping. |
---|
| 205 | ${RDIMON_SCRIPTS}: %: ${objtype}% |
---|
| 206 | cp $< $@ |
---|
| 207 | |
---|
| 208 | doc: |
---|
| 209 | info: |
---|
| 210 | install-info: |
---|
| 211 | clean-info: |
---|
| 212 | |
---|
| 213 | Makefile: Makefile.in config.status @host_makefile_frag_path@ |
---|
| 214 | $(SHELL) config.status |
---|
| 215 | |
---|
| 216 | config.status: configure |
---|
| 217 | $(SHELL) config.status --recheck |
---|
| 218 | |
---|
| 219 | include $(srcdir)/../multi-build.in |
---|