| 1 | # | 
|---|
| 2 | # Makefile | 
|---|
| 3 | #   Copyright (C) 1990, 1991, 1992, 1993 ,1994 Free Software Foundation | 
|---|
| 4 | # | 
|---|
| 5 | # This file is free software; you can redistribute it and/or modify | 
|---|
| 6 | # it under the terms of the GNU General Public License as published by | 
|---|
| 7 | # the Free Software Foundation; either version 2 of the License, or | 
|---|
| 8 | # (at your option) any later version. | 
|---|
| 9 | #  | 
|---|
| 10 | # This program is distributed in the hope that it will be useful, | 
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 13 | # GNU General Public License for more details. | 
|---|
| 14 | #  | 
|---|
| 15 | # You should have received a copy of the GNU General Public License | 
|---|
| 16 | # along with this program; if not, write to the Free Software | 
|---|
| 17 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ | 
|---|
| 18 | # | 
|---|
| 19 |  | 
|---|
| 20 | # | 
|---|
| 21 | # Makefile for newlib/libc/stub/hppa. This is the board support code | 
|---|
| 22 | # for the HP-PRO hppa embedded boards. <rob@cygnus.com> | 
|---|
| 23 | # | 
|---|
| 24 |  | 
|---|
| 25 | DESTDIR = | 
|---|
| 26 | VPATH = @srcdir@ | 
|---|
| 27 | srcdir = @srcdir@ | 
|---|
| 28 | objdir = . | 
|---|
| 29 | srcroot = $(srcdir)/../.. | 
|---|
| 30 | objroot = $(objdir)/../.. | 
|---|
| 31 |  | 
|---|
| 32 | prefix = @prefix | 
|---|
| 33 | exec_prefix = @exec_prefix@ | 
|---|
| 34 |  | 
|---|
| 35 | bindir = @bindir@ | 
|---|
| 36 | libdir = @libdir@ | 
|---|
| 37 | tooldir = $(exec_prefix)/$(target_alias) | 
|---|
| 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 |  | 
|---|
| 52 | # | 
|---|
| 53 | # As the boot process only deals with LIF volumes, here's the src | 
|---|
| 54 | # where we borrow existing code modules and where we put our | 
|---|
| 55 | # boot image if we can bvuild one. | 
|---|
| 56 | # | 
|---|
| 57 | LIF_SRC = /usr/tftpdir/srcboot.lif | 
|---|
| 58 | LIF_DEST = /usr/tftpdir/romboot.lif | 
|---|
| 59 |  | 
|---|
| 60 | HPDEFS = -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE \ | 
|---|
| 61 |          -D_INCLUDE_HPUX_SOURCE -DPCXT  | 
|---|
| 62 |  | 
|---|
| 63 | LIBS_FOR_TARGET = -lc | 
|---|
| 64 |  | 
|---|
| 65 | # | 
|---|
| 66 | # The original flags used by HP for the boot ROMS were | 
|---|
| 67 | # CFLAGS_FOR_TARGET = -c -Aa +O3 +OS -Wc,-DA1.0 -Wc,-DS1.0 +ESfic +ESsfc ${HPDEFS} | 
|---|
| 68 | CFLAGS_FOR_TARGET = -c -Wd,-a -g | 
|---|
| 69 | # the original value for -R was 0 | 
|---|
| 70 | LDFLAGS_FOR_TARGET =  -v -t -N -R 10000 -a archive | 
|---|
| 71 | INCLUDES = -I${srcdir} | 
|---|
| 72 |  | 
|---|
| 73 | BSP_OBJS= pa_stub.o debugger.o iva_table.o io.o | 
|---|
| 74 | STUBCRT0=crt0.o | 
|---|
| 75 | STUBLIB=hppa.o | 
|---|
| 76 | LDSCRIPT=hppa.ld | 
|---|
| 77 | SHARED_DIR= | 
|---|
| 78 | SHARED_OBJS= | 
|---|
| 79 | # SHARED_OBJS=$(SHARED_DIR) | 
|---|
| 80 |  | 
|---|
| 81 | # Host specific makefile fragment comes in here. | 
|---|
| 82 | @host_makefile_frag@ | 
|---|
| 83 |  | 
|---|
| 84 | all: boot | 
|---|
| 85 |  | 
|---|
| 86 | # this target is only for testing | 
|---|
| 87 | test: ${STUBCRT0} $(STUBLIB) test.o $(BSP_OBJS) | 
|---|
| 88 | #       ${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o $(BSP_OBJS) -o test $(LIBS_FOR_TARGET) | 
|---|
| 89 |         rootme=`pwd` ; \ | 
|---|
| 90 |         ${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o pa_stub.o debugger.o iva_table.o io.o -o test $(LIBS_FOR_TARGET) | 
|---|
| 91 |  | 
|---|
| 92 | $(STUBLIB): $(BSP_OBJS) | 
|---|
| 93 |         ${LD} -r $(BSP_OBJS) $(SHARED_OBJS) -o $(STUBLIB) | 
|---|
| 94 |  | 
|---|
| 95 | checksum: $(srcdir)/checksum.c | 
|---|
| 96 |         $(CC) -g $(srcdir)/checksum.c -o checksum | 
|---|
| 97 |  | 
|---|
| 98 | # this is the target from HP's Makefile, it may be bogus | 
|---|
| 99 | hpstub: $(OBJS) | 
|---|
| 100 |         $(LD) $(LDFLAGS_FOR_TARGET) -e main -o $@ $(LIBRARY)/crt1.o \ | 
|---|
| 101 |         $(OBJS) -lc -m >stub.map | 
|---|
| 102 |  | 
|---|
| 103 | install: | 
|---|
| 104 |         $(INSTALL_PROGRAM) $(STUBLIB) $(DESTDIR)$(tooldir)/lib/$(MULTISUBDIR)$(STUBLIB) | 
|---|
| 105 |         $(INSTALL_PROGRAM) $(SHARED_DIR)/$(STUBCRT0) $(DESTDIR)$(tooldir)/lib/$(MULTISUBDIR)$(STUBCRT0) | 
|---|
| 106 |         $(INSTALL_PROGRAM) $(srcdir)/$(LDSCRIPT) $(DESTDIR)$(tooldir)/lib/$(LDSCRIPT) | 
|---|
| 107 |  | 
|---|
| 108 | .c.o: | 
|---|
| 109 |         $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< | 
|---|
| 110 |  | 
|---|
| 111 | .c.s: | 
|---|
| 112 |         $(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $< | 
|---|
| 113 | #       $(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $< | 
|---|
| 114 |  | 
|---|
| 115 | .s.o: | 
|---|
| 116 |         $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< | 
|---|
| 117 | #       $(AS) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< | 
|---|
| 118 |  | 
|---|
| 119 | .SUFFIXES: .S .c .o .s .lif | 
|---|
| 120 | # | 
|---|
| 121 | # lifinit -- | 
|---|
| 122 | #       -vnnn   Sets volume size to nnn bytes.  | 
|---|
| 123 | #               nnn must be a multiple of 256. | 
|---|
| 124 | #       -d      Sets directory size to nnn file entries. | 
|---|
| 125 | #               nnn must be a multiple of 8. | 
|---|
| 126 | #       -nsss   Sets the volume name to be sss. | 
|---|
| 127 | #       -Knnn   Forces the directory start location to be the | 
|---|
| 128 | #               nearest multiple of nnn x 1024 bytes. | 
|---|
| 129 | #       -snnn   set the initial system load (ISL) start address to | 
|---|
| 130 | #               nnn in the volume label | 
|---|
| 131 | #       -lnnn   Specifies the length in bytes of the ISL code. | 
|---|
| 132 | #       -ennn   Set the ISL entry point to nnn bytes from the | 
|---|
| 133 | #               beginning of the ISL | 
|---|
| 134 | # | 
|---|
| 135 | # lifcp -- | 
|---|
| 136 | #       -r      Forces RAW mode copying. | 
|---|
| 137 | #       -T      Sets the file type of the directory entry. | 
|---|
| 138 | #               ASCII is 1 | 
|---|
| 139 | #               BIN is -23951 | 
|---|
| 140 | #               BINARY is -2 | 
|---|
| 141 | #       -Knnn   forces each file copied in to begin on a nnn x | 
|---|
| 142 | #               1024-byte boundary from the beginning of the volume | 
|---|
| 143 | #       Note: the word echoed below MUST be 10 characters exactly. | 
|---|
| 144 | # | 
|---|
| 145 | # somxtract infile outfile -- | 
|---|
| 146 | #       converts a series 800 file *only* into a raw image | 
|---|
| 147 | # | 
|---|
| 148 | LIF_VOL = this_lif | 
|---|
| 149 | # 65532 | 
|---|
| 150 | boot: test checksum | 
|---|
| 151 | #        FIXME: This fills up the hard disk unless "-R" is used | 
|---|
| 152 |         @rm -f ${LIF_VOL} ${LIF_DEST} | 
|---|
| 153 |         @ipl_entry=`nm -t d $< | grep "T .START." | sed -e 's/T .START.//' -e 's/^0*//'` ; \ | 
|---|
| 154 |         echo "Entry point is at $${ipl_entry}" ; \ | 
|---|
| 155 |         if test x"$${ipl_entry}" != x  ; then \ | 
|---|
| 156 |         ipl_entry=`expr $${ipl_entry} - 65536` ; \ | 
|---|
| 157 |         echo "Entry point offset is $${ipl_entry}" ; \ | 
|---|
| 158 |         cp $< $<.raw ; \ | 
|---|
| 159 |         rm -f $<.dis ; \ | 
|---|
| 160 |         objdump -d $< > $<.dis ; \ | 
|---|
| 161 |         somxtract $< $<.raw ; \ | 
|---|
| 162 |         ipl_size=`checksum -s $<.raw $<.image  | sed -e 's/ is the.*//'` ; \ | 
|---|
| 163 |         echo "IPL_SIZE is $${ipl_size}" ; \ | 
|---|
| 164 |             lifinit -v64000000 -d64 -n"CYGNUS    " -K2 -s4096 -l$${ipl_size} -e$${ipl_entry} ${LIF_DEST} ;\ | 
|---|
| 165 |             else \ | 
|---|
| 166 |                 echo "ERROR: \$$START\$$ symbol not found" ; \ | 
|---|
| 167 |             fi | 
|---|
| 168 |         @chmod a+rw $<.image | 
|---|
| 169 |         @lifcp -r -K2 $<.image ${LIF_DEST}:TEST | 
|---|
| 170 |         @rm -f $<.image $<.dis | 
|---|
| 171 |         @lifls -l ${LIF_DEST} | 
|---|
| 172 |         @objdump -d $< > $<.dis | 
|---|
| 173 |  | 
|---|
| 174 | .S.o: | 
|---|
| 175 |         rm -f $*.s | 
|---|
| 176 |         ${CPP} $< > $*.s | 
|---|
| 177 |         $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $*.s | 
|---|
| 178 | #       $(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $< | 
|---|
| 179 |  | 
|---|
| 180 | .c.list: | 
|---|
| 181 |         $(CC) $(CFLAGS) $*.c -S | 
|---|
| 182 |         $(AS) $(AFLAGS) $*.s -Wa,-l > $*.list | 
|---|
| 183 |         rm $*.s | 
|---|
| 184 |  | 
|---|
| 185 | .s.list: | 
|---|
| 186 |         $(AS) $(AFLAGS) $*.s -Wa,-l > $*.list | 
|---|
| 187 |  | 
|---|
| 188 | doc:     | 
|---|
| 189 |  | 
|---|
| 190 | clean mostlyclean: | 
|---|
| 191 |         rm -f *~ *.map *.list stub romboot.lif a.out *.raw *.image | 
|---|
| 192 |         rm -f *.o $(STUBLIB) $(STUBCRT0) checksum *.dis test | 
|---|
| 193 |  | 
|---|
| 194 | distclean maintainer-clean realclean: clean | 
|---|
| 195 |         rm -f Makefile config.cache config.log config.status | 
|---|
| 196 |          | 
|---|
| 197 | pa_stub.o:      $(srcdir)/pa_stub.c | 
|---|
| 198 | debugger.o:     $(srcdir)/debugger.s | 
|---|
| 199 | iva_table.o:    $(srcdir)/iva_table.s | 
|---|
| 200 | io.o:           $(srcdir)/io.c | 
|---|
| 201 | crt0.o:         $(srcdir)/crt0.s | 
|---|
| 202 | test.o:         $(srcdir)/test.c | 
|---|
| 203 | term_in.o:      $(srcdir)/term_in.s | 
|---|
| 204 | term_out.o:     $(srcdir)/term_out.s | 
|---|
| 205 | term_init.o:    $(srcdir)/term_init.s | 
|---|
| 206 |  | 
|---|
| 207 | .PHONY: info install-info clean-info | 
|---|
| 208 | info: | 
|---|
| 209 | install-info: | 
|---|
| 210 | clean-info: | 
|---|
| 211 |  | 
|---|
| 212 | Makefile: Makefile.in config.status @host_makefile_frag_path@ | 
|---|
| 213 |         $(SHELL) config.status | 
|---|
| 214 |  | 
|---|
| 215 | config.status: configure | 
|---|
| 216 |         $(SHELL) config.status --recheck | 
|---|