aboutsummaryrefslogtreecommitdiff
path: root/libgloss/hp74x/Makefile.in
blob: 0167e1c62ee371a8fea3c0b88043ed3536b51564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#
# Makefile
#   Copyright (C) 1990, 1991, 1992, 1993 ,1994 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
#

#
# Makefile for newlib/libc/stub/hppa. This is the board support code
# for the HP-PRO hppa embedded boards. <rob@cygnus.com>
#

DESTDIR =
VPATH = @srcdir@
srcdir = @srcdir@
objdir = .
srcroot = $(srcdir)/../..
objroot = $(objdir)/../..

prefix = @prefix
exec_prefix = @exec_prefix@

bindir = @bindir@
libdir = @libdir@
tooldir = $(exec_prefix)/$(target_alias)

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

SHELL = /bin/sh

mkinstalldirs = $(SHELL) $(srcroot)/mkinstalldirs

CC = @CC@

AS = @AS@
AR = @AR@
LD = @LD@
RANLIB = @RANLIB@

#
# As the boot process only deals with LIF volumes, here's the src
# where we borrow existing code modules and where we put our
# boot image if we can bvuild one.
#
LIF_SRC = /usr/tftpdir/srcboot.lif
LIF_DEST = /usr/tftpdir/romboot.lif

HPDEFS = -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE \
         -D_INCLUDE_HPUX_SOURCE -DPCXT 

LIBS_FOR_TARGET = -lc

#
# The original flags used by HP for the boot ROMS were
# CFLAGS_FOR_TARGET = -c -Aa +O3 +OS -Wc,-DA1.0 -Wc,-DS1.0 +ESfic +ESsfc ${HPDEFS}
CFLAGS_FOR_TARGET = -c -Wd,-a -g
# the original value for -R was 0
LDFLAGS_FOR_TARGET =  -v -t -N -R 10000 -a archive
INCLUDES = -I${srcdir}

BSP_OBJS= pa_stub.o debugger.o iva_table.o io.o
STUBCRT0=crt0.o
STUBLIB=hppa.o
LDSCRIPT=hppa.ld
SHARED_DIR=
SHARED_OBJS=
# SHARED_OBJS=$(SHARED_DIR)

# Host specific makefile fragment comes in here.
@host_makefile_frag@

all: boot

# this target is only for testing
test: ${STUBCRT0} $(STUBLIB) test.o $(BSP_OBJS)
#	${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o $(BSP_OBJS) -o test $(LIBS_FOR_TARGET)
	rootme=`pwd` ; \
	${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o pa_stub.o debugger.o iva_table.o io.o -o test $(LIBS_FOR_TARGET)

$(STUBLIB): $(BSP_OBJS)
	${LD} -r $(BSP_OBJS) $(SHARED_OBJS) -o $(STUBLIB)

checksum: $(srcdir)/checksum.c
	$(CC) -g $(srcdir)/checksum.c -o checksum

# this is the target from HP's Makefile, it may be bogus
hpstub: $(OBJS)
	$(LD) $(LDFLAGS_FOR_TARGET) -e main -o $@ $(LIBRARY)/crt1.o \
	$(OBJS) -lc -m >stub.map

install:
	${mkinstalldirs} ${DESTDIR}${tooldir}/lib/${MULTISUBDIR}
	$(INSTALL_PROGRAM) $(STUBLIB) $(DESTDIR)$(tooldir)/lib/$(MULTISUBDIR)$(STUBLIB)
	$(INSTALL_PROGRAM) $(SHARED_DIR)/$(STUBCRT0) $(DESTDIR)$(tooldir)/lib/$(MULTISUBDIR)$(STUBCRT0)
	$(INSTALL_PROGRAM) $(srcdir)/$(LDSCRIPT) $(DESTDIR)$(tooldir)/lib/$(LDSCRIPT)

.c.o:
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<

.c.s:
	$(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $<
#	$(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $<

.s.o:
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
#	$(AS) $(CFLAGS_FOR_TARGET) -c $<

.SUFFIXES: .S .c .o .s .lif
#
# lifinit --
#	-vnnn 	Sets volume size to nnn bytes. 
#		nnn must be a multiple of 256.
#	-d    	Sets directory size to nnn file entries.
#		nnn must be a multiple of 8.
#	-nsss   Sets the volume name to be sss.
#	-Knnn	Forces the directory start location to be the
#               nearest multiple of nnn x 1024 bytes.
#	-snnn	set the initial system load (ISL) start address to
#               nnn in the volume label
#	-lnnn	Specifies the length in bytes of the ISL code.
#	-ennn	Set the ISL entry point to nnn bytes from the
#               beginning of the ISL
#
# lifcp --
#	-r	Forces RAW mode copying.
#	-T	Sets the file type of the directory entry.
#		ASCII is 1
#		BIN is -23951
#		BINARY is -2
#	-Knnn	forces each file copied in to begin on a nnn x
#               1024-byte boundary from the beginning of the volume
#	Note: the word echoed below MUST be 10 characters exactly.
#
# somxtract infile outfile --
#	converts a series 800 file *only* into a raw image
#
LIF_VOL = this_lif
# 65532
boot: test checksum
#	 FIXME: This fills up the hard disk unless "-R" is used
	@rm -f ${LIF_VOL} ${LIF_DEST}
	@ipl_entry=`nm -t d $< | grep "T .START." | sed -e 's/T .START.//' -e 's/^0*//'` ; \
	echo "Entry point is at $${ipl_entry}" ; \
	if test x"$${ipl_entry}" != x  ; then \
	ipl_entry=`expr $${ipl_entry} - 65536` ; \
	echo "Entry point offset is $${ipl_entry}" ; \
	cp $< $<.raw ; \
	rm -f $<.dis ; \
	objdump -d $< > $<.dis ; \
	somxtract $< $<.raw ; \
	ipl_size=`checksum -s $<.raw $<.image  | sed -e 's/ is the.*//'` ; \
	echo "IPL_SIZE is $${ipl_size}" ; \
	    lifinit -v64000000 -d64 -n"CYGNUS    " -K2 -s4096 -l$${ipl_size} -e$${ipl_entry} ${LIF_DEST} ;\
	    else \
		echo "ERROR: \$$START\$$ symbol not found" ; \
	    fi
	@chmod a+rw $<.image
	@lifcp -r -K2 $<.image ${LIF_DEST}:TEST
	@rm -f $<.image $<.dis
	@lifls -l ${LIF_DEST}
	@objdump -d $< > $<.dis

.S.o:
	rm -f $*.s
	${CPP} $< > $*.s
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $*.s
#	$(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $<

.c.list:
	$(CC) $(CFLAGS) $*.c -S
	$(AS) $(AFLAGS) $*.s -Wa,-l > $*.list
	rm $*.s

.s.list:
	$(AS) $(AFLAGS) $*.s -Wa,-l > $*.list

doc:	

clean mostlyclean:
	rm -f *~ *.map *.list stub romboot.lif a.out *.raw *.image
	rm -f *.o $(STUBLIB) $(STUBCRT0) checksum *.dis test

distclean maintainer-clean realclean: clean
	rm -f Makefile
	
pa_stub.o:	$(srcdir)/pa_stub.c
debugger.o:	$(srcdir)/debugger.s
iva_table.o:	$(srcdir)/iva_table.s
io.o:		$(srcdir)/io.c
crt0.o:		$(srcdir)/crt0.s
test.o:		$(srcdir)/test.c
term_in.o:      $(srcdir)/term_in.s
term_out.o:     $(srcdir)/term_out.s
term_init.o:    $(srcdir)/term_init.s

.PHONY: info install-info clean-info
info:
install-info:
clean-info:

Makefile: Makefile.in ../config.status
	cd .. && $(SHELL) config.status