1############################################################################
2#
3# File:		 PXK:Makefile
4# Description:  Makefile for bpsl (microkernel).
5# Author:	   Harold Carr and Leigh Stoller.
6# Created:	  29-Sep-86
7# Modified:	06-Oct-87 (Harold Carr)
8# Mode:		 Text
9# Package:
10# Status:
11#
12#(c) Copyright 1982, University of Utah
13# %
14# % Redistribution and use in source and binary forms, with or without
15# % modification, are permitted provided that the following conditions are met:
16# %
17# %    * Redistributions of source code must retain the relevant copyright
18# %      notice, this list of conditions and the following disclaimer.
19# %    * Redistributions in binary form must reproduce the above copyright
20# %      notice, this list of conditions and the following disclaimer in the
21# %      documentation and/or other materials provided with the distribution.
22# %
23# % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24# % AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25# % THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26# % PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR
27# % CONTRIBUTORS
28# % BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29# % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30# % SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31# % INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32# % CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33# % ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34# % POSSIBILITY OF SUCH DAMAGE.
35#
36##############################################################################
37# Revisions
38#
39# 02-20-88 (Chris Burdorf)
40# Got rid of malloc.o, increased BPSSIZE, and added -Bstatic to ld to
41# make it run under SUN3 OS.
42# 09-Oct-87 (Leigh Stoller)
43#  Do not remove bps.o. Disk is cheap, and it avoids having to relink
44#   bpsl every time we rebuild.
45# 06-Oct-87 (Harold Carr)
46#  Add variables: USERDIR to make it still easier to build things into
47#  the microkernel.
48# 01-Sep-87 (Harold Carr)
49#  Added variables: USERSLFILES, USERLIBS, and USEROFILES to make it easy for
50#  a random user to build .o files, libs and .sl files into the microkernel.
51# 26-11-86 (Tim Mueller)
52#  Made extendible and portable. This makefile can be
53#  copied to a directory where a private version of the
54#  psl kernel (bpsl) with external C code can be constructed.
55#  Added main.awk script to automatically construct commands
56#  to feed to the cross-compiler to produce main.s .
57#
58##############################################################################
59
60PROOT   = /silo/cons/verkaufpsl
61
62#### MACHINE = unix386
63PSL	= $(PROOT)/dist
64PSYS	= $(PROOT)/bin
65PK	= $(PSL)/kernel
66PXK	 = $(PK)/$(MACHINE)
67PNK	= $(PSL)/nonkernel
68PXNK	= $(PNK)/$(MACHINE)
69PNKL	= $(PSL)/nonkernel/$(MACHINE)/lap
70PC	= $(PSL)/comp
71PXC	 = $(PC)/$(MACHINE)
72PU	= $(PSL)/util
73PXU	 = $(PU)/$(MACHINE)
74PDIST   = $(PSL)/distrib
75PXDIST  = $(PDIST)/$(MACHINE)
76PL	= $(PSL)/lap/unix386
77
78CRT0	= /lib/crt0.o
79
80OTHEROFILES = \
81	$(PXK)/os-hooks.o \
82	$(PXK)/pslextras.o
83
84OTHERCFILES = \
85	$(PXK)/os-hooks.c \
86	$(PXK)/pslextras.c
87
88# Use -L in the assembler to keep labels that begin with "L".
89ASARGS =
90#CFLAGS =
91
92# Header file to support car/cdr of NIL.
93NIL =
94
95# Loader arguments.
96LDARGS = -x -e _start -Bstatic
97BPSSIZE = 1500000
98
99# If a user wants to include their own .o files, libraries and .sl files
100# to be built into bpsl then they should be defined with these variables.
101
102#USERLIBS	=
103#USEROFILES  =
104#USERSLFILES =
105
106# If a user wants to include their own stuff in their own private copy
107# of the microkernel they should pass this variable so that a private
108# copy of bpsl will be built in the given directory.
109
110USERDIR = $(PXK)
111
112###################################################################
113
114default: $(USERDIR)/bpsl
115
116bpsl: default
117
118###################################################################
119# Object files for ld -
120# Local .o files can be added to this list.
121OFILES=	\
122	$(PXK)/echo.o \
123	$(PXK)/file-status.o \
124	$(PXK)/float.o \
125	$(PXK)/pwd-fn.o \
126	$(PXK)/sigs.o \
127	$(PXK)/unexec.o \
128	$(PXK)/unix-io.o \
129	$(OTHEROFILES)
130CFILES=	\
131	$(PXK)/bps.c \
132	$(PXK)/bpsheap.c \
133	$(PXK)/echo.c \
134	$(PXK)/file-status.c \
135	$(PXK)/float.c \
136	$(PXK)/pwd-fn.c \
137	$(PXK)/sigs.c \
138	$(PXK)/unexec.c \
139	$(PXK)/unix-io.c \
140	$(OTHERCFILES)
141
142#####################################################################
143# .sl files - Files to be dskin'ed to the cross-assembler to make main.s
144# Add local external function definitions (.sl) files here to reference
145# external C code.
146SLFILES= \
147	$(PXK)/main-start.sl \
148	$(PXK)/io.sl \
149	$(PXK)/intern.sl \
150	$(PXK)/faslin.sl \
151	$(PXK)/alloc.sl \
152	$(PK)/support.sl \
153	$(PXK)/sys-support.sl \
154	$(PXK)/externals.sl \
155	$(USERSLFILES)
156
157BFILES= \
158	$(PL)/fasl-decls.b \
159	$(PL)/f-strings.b \
160	$(PL)/fast-vector.b \
161	$(PL)/hash-decls.b \
162	$(PL)/s-strings.b \
163	$(PL)/sys-consts.b
164
165.SUFFIXES: .b .c .o .s .sl
166
167# Add libraries for external C code references here.
168#LIBS =
169CRT1  =
170
171
172# Use -n for shared text, -q for demand paged (on some unixes).
173
174$(USERDIR)/bpsl: $(CCFILES)  \
175		$(USERDIR)/main.o $(USERDIR)/dmain.o \
176		$(PXK)/Makefile
177	$(USERDIR)/cclnk
178
179$(USERDIR)/dmain.o:
180	mv $(USERDIR)/dmain.s $(USERDIR)/dmain.temp
181	sed -f $(PXK)/dmain.sed $(USERDIR)/dmain.temp > $(USERDIR)/dmain.s
182	rm -f $(USERDIR)/dmain.temp
183	as $(ASARGS) -o $(USERDIR)/dmain.o $(USERDIR)/dmain.s
184
185$(USERDIR)/main.o: $(USERDIR)/main.s $(PXK)/main.sed
186	mv $(USERDIR)/main.s $(USERDIR)/main.temp
187	sed -f $(PXK)/main.sed $(USERDIR)/main.temp > $(USERDIR)/main.s
188	rm -f $(USERDIR)/main.temp
189	as $(ASARGS) -o $(USERDIR)/main.o $(USERDIR)/main.s
190
191$(USERDIR)/main.s: $(BFILES) $(SLFILES)
192	-rm -f $(USERDIR)/$(MACHINE).sym
193	cp $(PC)/bare-psl.sym $(USERDIR)/$(MACHINE).sym
194	(cd $(USERDIR)/; \
195	 echo $(SLFILES) | awk -f $(PXK)/main.awk > tmp.sl; \
196	$(PXK)/$(MACHINE)-cross tmp.sl)
197
198$(PL)/fasl-decls.b: $(PXK)/fasl-decls.sl
199	$(PDIST)/make-lap $(PXK) fasl-decls
200
201$(PL)/f-strings.b: $(PU)/f-strings.sl
202	$(PDIST)/make-lap $(PU) f-strings
203
204$(PL)/fast-vector.b: $(PU)/fast-vector.sl $(PL)/if-system.b
205	$(PDIST)/make-lap $(PU) fast-vector
206
207$(PL)/hash-decls.b: $(PK)/hash-decls.sl
208	$(PDIST)/make-lap $(PK) hash-decls
209
210$(PL)/if-system.b: $(PU)/if-system.sl
211	$(PDIST)/make-lap $(PU) if-system
212
213$(PL)/s-strings.b: $(PU)/s-strings.sl
214	$(PDIST)/make-lap $(PU) s-strings
215
216$(PL)/sys-consts.b: $(PXC)/sys-consts.sl
217	$(PDIST)/make-lap $(PXC) sys-consts
218
219# End of file.
220