[444] | 1 | # Copyright (c) 2008-2014 Red Hat, Inc. All rights reserved. |
---|
| 2 | # |
---|
| 3 | # This copyrighted material is made available to anyone wishing to use, modify, |
---|
| 4 | # copy, or redistribute it subject to the terms and conditions of the BSD |
---|
| 5 | # License. This program is distributed in the hope that it will be useful, |
---|
| 6 | # but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties |
---|
| 7 | # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license |
---|
| 8 | # is available at http://www.opensource.org/licenses. Any Red Hat trademarks that |
---|
| 9 | # are incorporated in the source code or documentation are not subject to the BSD |
---|
| 10 | # License and may only be used or replicated with the express permission of |
---|
| 11 | # Red Hat, Inc. |
---|
| 12 | |
---|
| 13 | # Makefile for libgloss/msp430. |
---|
| 14 | |
---|
| 15 | DESTDIR = |
---|
| 16 | VPATH = @srcdir@ |
---|
| 17 | srcdir = @srcdir@ |
---|
| 18 | objdir = . |
---|
| 19 | srcroot = $(srcdir)/../.. |
---|
| 20 | objroot = $(objdir)/../.. |
---|
| 21 | |
---|
| 22 | prefix = @prefix@ |
---|
| 23 | exec_prefix = @exec_prefix@ |
---|
| 24 | |
---|
| 25 | host_alias = @host_alias@ |
---|
| 26 | target_alias = @target_alias@ |
---|
| 27 | |
---|
| 28 | bindir = @bindir@ |
---|
| 29 | libdir = @libdir@ |
---|
| 30 | tooldir = $(exec_prefix)/$(target_alias) |
---|
| 31 | |
---|
| 32 | # Multilib support variables. |
---|
| 33 | # TOP is used instead of MULTI{BUILD,SRC}TOP. |
---|
| 34 | MULTIDIRS = |
---|
| 35 | MULTISUBDIR = |
---|
| 36 | MULTIDO = true |
---|
| 37 | MULTICLEAN = true |
---|
| 38 | |
---|
| 39 | INSTALL = @INSTALL@ |
---|
| 40 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
---|
| 41 | INSTALL_DATA = @INSTALL_DATA@ |
---|
| 42 | |
---|
| 43 | SHELL = /bin/sh |
---|
| 44 | |
---|
| 45 | CC = @CC@ |
---|
| 46 | |
---|
| 47 | AS = @AS@ |
---|
| 48 | AR = @AR@ |
---|
| 49 | LD = @LD@ |
---|
| 50 | RANLIB = @RANLIB@ |
---|
| 51 | AR_FLAGS = rc |
---|
| 52 | |
---|
| 53 | OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ |
---|
| 54 | then echo ${objroot}/../binutils/objdump ; \ |
---|
| 55 | else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` |
---|
| 56 | OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ |
---|
| 57 | then echo ${objroot}/../binutils/objcopy ; \ |
---|
| 58 | else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` |
---|
| 59 | |
---|
| 60 | SCRIPTS = $(srcdir)/msp430-sim.ld |
---|
| 61 | SCRIPTS += $(srcdir)/msp430xl-sim.ld |
---|
| 62 | SCRIPTS += $(srcdir)/intr_vectors.ld |
---|
| 63 | |
---|
| 64 | CRT = gcrt0.o crt0.o crt0-minrt.o crtn.o crtn-minrt.o |
---|
| 65 | SIM_BSP = libsim.a |
---|
| 66 | LIB_NOSYS = libnosys.a |
---|
| 67 | LIB_CRT = libcrt.a |
---|
| 68 | |
---|
| 69 | SIM_OBJS = syscalls.o \ |
---|
| 70 | cio.o \ |
---|
| 71 | write.o \ |
---|
| 72 | sbrk.o |
---|
| 73 | |
---|
| 74 | NOSYS_OBJS = ciosyscalls.o \ |
---|
| 75 | cio.o \ |
---|
| 76 | write.o \ |
---|
| 77 | unlink.o \ |
---|
| 78 | sbrk.o |
---|
| 79 | |
---|
| 80 | # Each crt_*.o is built from crt0.S using -DL*. crt0.o is built from |
---|
| 81 | # crt0.s with -DL0 via the default rule below. |
---|
| 82 | CRT_OBJS = \ |
---|
| 83 | crt_bss.o \ |
---|
| 84 | crt_high_bss.o \ |
---|
| 85 | crt_movedata.o \ |
---|
| 86 | crt_move_highdata.o \ |
---|
| 87 | crt_main.o \ |
---|
| 88 | crt_main_minrt.o \ |
---|
| 89 | crt_callexit.o \ |
---|
| 90 | crt_init.o |
---|
| 91 | |
---|
| 92 | #### Host specific Makefile fragment comes in here. |
---|
| 93 | @host_makefile_frag@ |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | all: $(CRT) $(SIM_BSP) $(LIB_NOSYS) $(LIB_CRT) copy_scripts_to_objdir |
---|
| 97 | |
---|
| 98 | crt_%.o : crt0.S |
---|
| 99 | $(CC) -DL$* -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< -o $@ |
---|
| 100 | |
---|
| 101 | crt0-minrt.o : crt0.S |
---|
| 102 | $(CC) -DL0 -DMINRT -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< -o $@ |
---|
| 103 | |
---|
| 104 | crtn-minrt.o : crtn.S |
---|
| 105 | $(CC) -DL0 -DMINRT -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< -o $@ |
---|
| 106 | |
---|
| 107 | # Override .S.o rule to pass assembler debugging flags |
---|
| 108 | .S.o: |
---|
| 109 | $(CC) -DL0 -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< |
---|
| 110 | |
---|
| 111 | $(SIM_BSP): $(SIM_OBJS) |
---|
| 112 | $(AR) $(ARFLAGS) $@ $? |
---|
| 113 | $(RANLIB) $@ |
---|
| 114 | |
---|
| 115 | $(LIB_NOSYS): $(NOSYS_OBJS) |
---|
| 116 | $(AR) $(ARFLAGS) $@ $? |
---|
| 117 | $(RANLIB) $@ |
---|
| 118 | |
---|
| 119 | $(LIB_CRT): $(CRT_OBJS) |
---|
| 120 | $(AR) $(ARFLAGS) $@ $? |
---|
| 121 | $(RANLIB) $@ |
---|
| 122 | |
---|
| 123 | copy_scripts_to_objdir: $(SCRIPTS) |
---|
| 124 | cp $(SCRIPTS) $(objdir) |
---|
| 125 | |
---|
| 126 | # Dependencies |
---|
| 127 | |
---|
| 128 | SDEPS = $(srcdir)/cio.h |
---|
| 129 | |
---|
| 130 | abort.o : $(SDEPS) |
---|
| 131 | argv.o : $(SDEPS) |
---|
| 132 | argvlen.o : $(SDEPS) |
---|
| 133 | chdir.o : $(SDEPS) |
---|
| 134 | chmod.o : $(SDEPS) |
---|
| 135 | close.o : $(SDEPS) |
---|
| 136 | exit.o : $(SDEPS) |
---|
| 137 | fstat.o : $(SDEPS) |
---|
| 138 | getpid.o : $(SDEPS) |
---|
| 139 | gettimeofday.o : $(SDEPS) |
---|
| 140 | gcrt0.o: gcrt0.S crt0.S |
---|
| 141 | kill.o : $(SDEPS) |
---|
| 142 | link.o : $(SDEPS) |
---|
| 143 | lseek.o : $(SDEPS) |
---|
| 144 | mcount.o : $(SDEPS) |
---|
| 145 | open.o : $(SDEPS) |
---|
| 146 | read.o : $(SDEPS) |
---|
| 147 | sigprocmask.o : $(SDEPS) |
---|
| 148 | sleep.o : $(SDEPS) |
---|
| 149 | stat.o : $(SDEPS) |
---|
| 150 | time.o : $(SDEPS) |
---|
| 151 | times.o : $(SDEPS) |
---|
| 152 | unlink.o : $(SDEPS) |
---|
| 153 | utime.o : $(SDEPS) |
---|
| 154 | write.o : $(SDEPS) |
---|
| 155 | |
---|
| 156 | install: $(CRT) $(SIM_BSP) $(LIB_NOSYS) $(LIB_CRT) $(SCRIPTS) |
---|
| 157 | mkdir -p $(DESTDIR)$(tooldir)/lib${MULTISUBDIR} |
---|
| 158 | for c in $(CRT) $(SIM_BSP) $(LIB_NOSYS) $(LIB_CRT); do \ |
---|
| 159 | $(INSTALL_DATA) $$c $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$c ;\ |
---|
| 160 | done |
---|
| 161 | for c in $(SCRIPTS); do \ |
---|
| 162 | b=`basename $$c`; \ |
---|
| 163 | $(INSTALL_DATA) $$c $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$b ;\ |
---|
| 164 | done |
---|
| 165 | |
---|
| 166 | clean mostlyclean: |
---|
| 167 | rm -f *.o *.a |
---|
| 168 | |
---|
| 169 | distclean maintainer-clean realclean: clean |
---|
| 170 | rm -f Makefile config.cache config.log config.status |
---|
| 171 | |
---|
| 172 | .PHONY: info dvi doc install-info clean-info |
---|
| 173 | info doc dvi: |
---|
| 174 | install-info: |
---|
| 175 | clean-info: |
---|
| 176 | |
---|
| 177 | Makefile: Makefile.in config.status @host_makefile_frag_path@ |
---|
| 178 | $(SHELL) config.status |
---|
| 179 | |
---|
| 180 | config.status: configure |
---|
| 181 | $(SHELL) config.status --recheck |
---|