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:        Open Source: BSD License
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##############################################################################
38# Revisions
39#
40# 02-20-88 (Chris Burdorf)
41# Got rid of malloc.o, increased BPSSIZE, and added -Bstatic to ld to
42# make it run under SUN3 OS.
43# 09-Oct-87 (Leigh Stoller)
44#  Do not remove bps.o. Disk is cheap, and it avoids having to relink
45#   bpsl every time we rebuild.
46# 06-Oct-87 (Harold Carr)
47#  Add variables: USERDIR to make it still easier to build things into
48#  the microkernel.
49# 01-Sep-87 (Harold Carr)
50#  Added variables: USERSLFILES, USERLIBS, and USEROFILES to make it easy for
51#  a random user to build .o files, libs and .sl files into the microkernel.
52# 26-11-86 (Tim Mueller)
53#  Made extendible and portable. This makefile can be
54#  copied to a directory where a private version of the
55#  psl kernel (bpsl) with external C code can be constructed.
56#  Added main.awk script to automatically construct commands
57#  to feed to the cross-compiler to produce main.s .
58#
59##############################################################################
60
61PROOT   = /home/rainer/software/reduce/psl
62
63#### MACHINE = unix386
64PSL	= $(PROOT)/dist
65PSYS	= $(PROOT)/bin
66PK	= $(PSL)/kernel
67PXK	 = $(PK)/$(MACHINE)
68PNK	= $(PSL)/nonkernel
69PXNK	= $(PNK)/$(MACHINE)
70PNKL	= $(PSL)/nonkernel/$(MACHINE)/lap
71PC	= $(PSL)/comp
72PXC	 = $(PC)/$(MACHINE)
73PU	= $(PSL)/util
74PXU	 = $(PU)/$(MACHINE)
75PDIST   = $(PSL)/distrib
76PXDIST  = $(PDIST)/$(MACHINE)
77PL	= $(PSL)/lap/$(MACHINE)
78
79#CRT0	= /lib/crt0.o
80
81OTHEROFILES = \
82	$(PXK)/os-hooks.o \
83	$(PXK)/pslextras.o
84
85OTHERCFILES = \
86	$(PXK)/os-hooks.c \
87	$(PXK)/pslextras.c
88
89# Use -L in the assembler to keep labels that begin with "L".
90ASPROG = x86_64-w64-mingw32-as
91ASARGS =
92CCPROG = x86_64-w64-mingw32-gcc
93#CFLAGS =
94
95# Header file to support car/cdr of NIL.
96NIL =
97
98# If a user wants to include their own .o files, libraries and .sl files
99# to be built into bpsl then they should be defined with these variables.
100
101#USERLIBS	=
102#USEROFILES  =
103#USERSLFILES =
104
105# If a user wants to include their own stuff in their own private copy
106# of the microkernel they should pass this variable so that a private
107# copy of bpsl will be built in the given directory.
108
109USERDIR = $(PXK)
110
111###################################################################
112
113default: $(USERDIR)/bpsl.exe
114
115bpsl: default
116
117###################################################################
118# Object files for ld -
119# Local .o files can be added to this list.
120OFILES=	\
121	$(PXK)/echo.o \
122	$(PXK)/file-status.o \
123	$(PXK)/float.o \
124	$(PXK)/pwd-fn.o \
125	$(PXK)/sigs.o \
126	$(PXK)/unix-io.o \
127	$(OTHEROFILES)
128CFILES=	\
129	$(PXK)/bps.c \
130	$(PXK)/bpsheap.c \
131	$(PXK)/echo.c \
132	$(PXK)/file-status.c \
133	$(PXK)/float.c \
134	$(PXK)/pwd-fn.c \
135	$(PXK)/sigs.c \
136	$(PXK)/unix-io.c \
137	$(OTHERCFILES)
138
139#####################################################################
140# .sl files - Files to be dskin'ed to the cross-assembler to make main.s
141# Add local external function definitions (.sl) files here to reference
142# external C code.
143SLFILES= \
144	$(PXK)/main-start.sl \
145	$(PXK)/io.sl \
146	$(PXK)/intern.sl \
147	$(PXK)/faslin.sl \
148	$(PXK)/alloc.sl \
149	$(PK)/support.sl \
150	$(PXK)/sys-support.sl \
151	$(PXK)/externals.sl \
152	$(USERSLFILES)
153
154BFILES= \
155	$(PL)/fasl-decls.b \
156	$(PL)/f-strings.b \
157	$(PL)/fast-vector.b \
158	$(PL)/hash-decls.b \
159	$(PL)/s-strings.b \
160	$(PL)/sys-consts.b
161
162bfiles: $(BFILES)
163
164.SUFFIXES: .b .c .o .s .sl
165
166# Add libraries for external C code references here.
167#LIBS =
168#CRT1  =
169
170# Use -n for shared text, -q for demand paged (on some unixes).
171
172$(USERDIR)/bpsl.exe: $(CFILES)  \
173		$(USERDIR)/main.o $(USERDIR)/dmain.o
174	$(USERDIR)/cclnk
175
176$(USERDIR)/dmain.o: $(USERDIR)/dmain.s
177#	cp $(USERDIR)/dmain.s $(USERDIR)/dmain.s.orig
178#	sed -f $(PXK)/dmain.sed -i $(USERDIR)/dmain.s
179	$(ASPROG) $(ASARGS) -o $(USERDIR)/dmain.o $(USERDIR)/dmain.s
180
181$(USERDIR)/main.o: $(USERDIR)/main.s
182#	cp $(USERDIR)/main.s $(USERDIR)/main.s.orig
183#	sed -f $(PXK)/main.sed -i $(USERDIR)/main.s
184	$(ASPROG) $(ASARGS) -o $(USERDIR)/main.o $(USERDIR)/main.s
185
186$(USERDIR)/main.s: $(BFILES) $(SLFILES) $(PXK)/main.sed \
187		$(PXK)/dmain.sed
188	-rm -f $(USERDIR)/$(MACHINE).sym
189	cp $(PC)/bare-psl.sym $(USERDIR)/$(MACHINE).sym
190	(cd $(USERDIR)/; \
191	 echo $(SLFILES) | awk -f $(PXK)/main.awk > tmp.sl; \
192	$(PXK)/$(MACHINE)-cross tmp.sl)
193
194$(PL)/fasl-decls.b: $(PXK)/fasl-decls.sl
195	$(PDIST)/make-lap $(PXK) fasl-decls
196
197$(PL)/f-strings.b: $(PU)/f-strings.sl
198	$(PDIST)/make-lap $(PU) f-strings
199
200$(PL)/fast-vector.b: $(PU)/fast-vector.sl $(PL)/if-system.b
201	$(PDIST)/make-lap $(PU) fast-vector
202
203$(PL)/hash-decls.b: $(PXK)/hash-decls.sl
204	$(PDIST)/make-lap $(PXK) hash-decls
205
206$(PL)/if-system.b: $(PU)/if-system.sl
207	$(PDIST)/make-lap $(PU) if-system
208
209$(PL)/s-strings.b: $(PU)/s-strings.sl
210	$(PDIST)/make-lap $(PU) s-strings
211
212$(PL)/sys-consts.b: $(PXC)/sys-consts.sl
213	$(PDIST)/make-lap $(PXC) sys-consts
214
215# End of file.
216