| 1 | # Copyright (c) 2008, 2009, 2011 Red Hat Inc | 
|---|
| 2 | # | 
|---|
| 3 | # The authors hereby grant permission to use, copy, modify, distribute, | 
|---|
| 4 | # and license this software and its documentation for any purpose, provided | 
|---|
| 5 | # that existing copyright notices are retained in all copies and that this | 
|---|
| 6 | # notice is included verbatim in any distributions. No written agreement, | 
|---|
| 7 | # license, or royalty fee is required for any of the authorized uses. | 
|---|
| 8 | # Modifications to this software may be copyrighted by their authors | 
|---|
| 9 | # and need not follow the licensing terms described here, provided that | 
|---|
| 10 | # the new terms are clearly indicated on the first page of each file where | 
|---|
| 11 | # they apply. | 
|---|
| 12 |  | 
|---|
| 13 | # Makefile for libgloss/rl78. | 
|---|
| 14 |  | 
|---|
| 15 | VPATH = @srcdir@ | 
|---|
| 16 | srcdir = @srcdir@ | 
|---|
| 17 | objdir = . | 
|---|
| 18 | srcroot = $(srcdir)/../.. | 
|---|
| 19 | objroot = $(objdir)/../.. | 
|---|
| 20 |  | 
|---|
| 21 | prefix = @prefix@ | 
|---|
| 22 | exec_prefix = @exec_prefix@ | 
|---|
| 23 |  | 
|---|
| 24 | host_alias = @host_alias@ | 
|---|
| 25 | target_alias = @target_alias@ | 
|---|
| 26 |  | 
|---|
| 27 | bindir = @bindir@ | 
|---|
| 28 | libdir = @libdir@ | 
|---|
| 29 | tooldir = $(exec_prefix)/$(target_alias) | 
|---|
| 30 |  | 
|---|
| 31 | # Multilib support variables. | 
|---|
| 32 | # TOP is used instead of MULTI{BUILD,SRC}TOP. | 
|---|
| 33 | MULTIDIRS = | 
|---|
| 34 | MULTISUBDIR = | 
|---|
| 35 | MULTIDO = true | 
|---|
| 36 | MULTICLEAN = true | 
|---|
| 37 |  | 
|---|
| 38 | INSTALL = @INSTALL@ | 
|---|
| 39 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | 
|---|
| 40 | INSTALL_DATA = @INSTALL_DATA@ | 
|---|
| 41 |  | 
|---|
| 42 | SHELL = /bin/sh | 
|---|
| 43 |  | 
|---|
| 44 | CC = @CC@ | 
|---|
| 45 |  | 
|---|
| 46 | AS = @AS@ | 
|---|
| 47 | AR = @AR@ | 
|---|
| 48 | LD = @LD@ | 
|---|
| 49 | RANLIB = @RANLIB@ | 
|---|
| 50 | AR_FLAGS = rc | 
|---|
| 51 |  | 
|---|
| 52 | OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ | 
|---|
| 53 |         then echo ${objroot}/../binutils/objdump ; \ | 
|---|
| 54 |         else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` | 
|---|
| 55 | OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ | 
|---|
| 56 |         then echo ${objroot}/../binutils/objcopy ; \ | 
|---|
| 57 |         else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` | 
|---|
| 58 |  | 
|---|
| 59 | SCRIPTS = $(srcdir)/rl78.ld $(srcdir)/rl78-sim.ld | 
|---|
| 60 | CRT = gcrt0.o crt0.o crtn.o | 
|---|
| 61 | SIM_BSP = libsim.a | 
|---|
| 62 | LIBNOSYS = ../libnosys/libnosys.a | 
|---|
| 63 | SIM_OBJS = \ | 
|---|
| 64 |         sbrk.o \ | 
|---|
| 65 |         exit.o \ | 
|---|
| 66 |         open.o \ | 
|---|
| 67 |         close.o \ | 
|---|
| 68 |         read.o \ | 
|---|
| 69 |         write.o \ | 
|---|
| 70 |         swrite.o \ | 
|---|
| 71 |         lseek.o \ | 
|---|
| 72 |         unlink.o \ | 
|---|
| 73 |         getpid.o \ | 
|---|
| 74 |         kill.o \ | 
|---|
| 75 |         fstat.o \ | 
|---|
| 76 |         argvlen.o \ | 
|---|
| 77 |         argv.o \ | 
|---|
| 78 |         chdir.o \ | 
|---|
| 79 |         stat.o \ | 
|---|
| 80 |         chmod.o \ | 
|---|
| 81 |         utime.o \ | 
|---|
| 82 |         time.o \ | 
|---|
| 83 |         gettimeofday.o \ | 
|---|
| 84 |         times.o \ | 
|---|
| 85 |         link.o \ | 
|---|
| 86 |         isatty.o \ | 
|---|
| 87 |         abort.o \ | 
|---|
| 88 |         mcount.o | 
|---|
| 89 |  | 
|---|
| 90 | #### Host specific Makefile fragment comes in here. | 
|---|
| 91 | @host_makefile_frag@ | 
|---|
| 92 |  | 
|---|
| 93 |  | 
|---|
| 94 | # Override .S.o rule to pass assembler debugging flags | 
|---|
| 95 | .S.o: | 
|---|
| 96 |         $(CC) -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< | 
|---|
| 97 |  | 
|---|
| 98 | all: $(CRT) $(SIM_BSP) copy_scripts_to_objdir | 
|---|
| 99 |  | 
|---|
| 100 | $(SIM_BSP): $(SIM_OBJS) | 
|---|
| 101 |         $(AR) $(ARFLAGS) $@ $? | 
|---|
| 102 |         $(RANLIB) $@ | 
|---|
| 103 |  | 
|---|
| 104 | copy_scripts_to_objdir: $(SCRIPTS) | 
|---|
| 105 |         cp $(SCRIPTS) $(objdir) | 
|---|
| 106 |  | 
|---|
| 107 | # Dependencies | 
|---|
| 108 |  | 
|---|
| 109 | SDEPS = $(srcdir)/rl78-sys.h $(srcdir)/../syscall.h | 
|---|
| 110 |  | 
|---|
| 111 | abort.o : $(SDEPS) | 
|---|
| 112 | argv.o : $(SDEPS) | 
|---|
| 113 | argvlen.o : $(SDEPS) | 
|---|
| 114 | chdir.o : $(SDEPS) | 
|---|
| 115 | chmod.o : $(SDEPS) | 
|---|
| 116 | close.o : $(SDEPS) | 
|---|
| 117 | exit.o : $(SDEPS) | 
|---|
| 118 | fstat.o : $(SDEPS) | 
|---|
| 119 | getpid.o : $(SDEPS) | 
|---|
| 120 | gettimeofday.o : $(SDEPS) | 
|---|
| 121 | gcrt0.o: gcrt0.S crt0.S | 
|---|
| 122 | kill.o : $(SDEPS) | 
|---|
| 123 | link.o : $(SDEPS) | 
|---|
| 124 | lseek.o : $(SDEPS) | 
|---|
| 125 | mcount.o : $(SDEPS) | 
|---|
| 126 | open.o : $(SDEPS) | 
|---|
| 127 | read.o : $(SDEPS) | 
|---|
| 128 | sigprocmask.o : $(SDEPS) | 
|---|
| 129 | sleep.o : $(SDEPS) | 
|---|
| 130 | stat.o : $(SDEPS) | 
|---|
| 131 | time.o : $(SDEPS) | 
|---|
| 132 | times.o : $(SDEPS) | 
|---|
| 133 | unlink.o : $(SDEPS) | 
|---|
| 134 | utime.o : $(SDEPS) | 
|---|
| 135 | write.o : $(SDEPS) | 
|---|
| 136 |  | 
|---|
| 137 | install: $(CRT) $(SIM_BSP) $(SCRIPTS) | 
|---|
| 138 |         for c in $(CRT) $(SIM_BSP); do \ | 
|---|
| 139 |           $(INSTALL_DATA) $$c $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$c ;\ | 
|---|
| 140 |         done | 
|---|
| 141 |         for c in $(SCRIPTS); do \ | 
|---|
| 142 |           b=`basename $$c`; \ | 
|---|
| 143 |           $(INSTALL_DATA) $$c $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$b ;\ | 
|---|
| 144 |         done | 
|---|
| 145 |  | 
|---|
| 146 | clean mostlyclean: | 
|---|
| 147 |         rm -f *.o *.a | 
|---|
| 148 |  | 
|---|
| 149 | distclean maintainer-clean realclean: clean | 
|---|
| 150 |         rm -f Makefile config.cache config.log config.status | 
|---|
| 151 |  | 
|---|
| 152 | .PHONY: info dvi doc install-info clean-info | 
|---|
| 153 | info doc dvi: | 
|---|
| 154 | install-info: | 
|---|
| 155 | clean-info: | 
|---|
| 156 |  | 
|---|
| 157 | Makefile: Makefile.in config.status @host_makefile_frag_path@ | 
|---|
| 158 |         $(SHELL) config.status | 
|---|
| 159 |  | 
|---|
| 160 | config.status: configure | 
|---|
| 161 |         $(SHELL) config.status --recheck | 
|---|