# Modified A-P Virtanen for GNU-make 14-Dec-1992

#
# Mach Operating System
# Copyright (c) 1992 Carnegie Mellon University
# All Rights Reserved.
# 
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
# 
# CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
# CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
# ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
# 
# Carnegie Mellon requests users of this software to return to
# 
#  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
#  School of Computer Science
#  Carnegie Mellon University
#  Pittsburgh PA 15213-3890
# 
# any improvements or extensions that they make and grant Carnegie Mellon
# the rights to redistribute these changes.
#  
#
# HISTORY
# $Log:	Makefile,v $
# Revision 2.5  92/03/05  22:49:40  rpd
# 	Added Makefile-man.
# 	[92/02/29            rpd]
# 
# Revision 2.4  92/02/16  15:44:17  rpd
# 	Changed name from libcs.a to libcmucs.a.
# 	[92/02/16            rpd]
# 
# Revision 2.3  92/02/16  15:24:49  rpd
# 	Moved from libcs to libcmucs.
# 
# Revision 2.2  92/01/22  23:14:33  rpd
# 	Created.
# 	[92/01/17            rpd]
# 

# This is a pared-down version of CMU's libcs.a and libsys.a
# It includes only those functions required by Mach software.

#include ${MAKETOP}Makefile-common

# find machine-dependent files in machine subdirectory

VPATH = .:ns532

# functions in section 2 (CMU-CS system calls)
FUNCTIONS2 = table

# functions in section 3 (CMU-CS libc additions)
FUNCTIONS3 = atoh getname openp searchp quit

# use Makefile-lib and Makefile-man for most of the rules

all: libcmucs.a

INCDIR = /usr/local/pc532-mach/DIST/include
INCLUDES= -nostdinc -I. -I$(INCDIR) -I/usr/local/pc532-mach/bsdss/server -I/usr/antsu/src/net/include

# top-level targets

DEFINES = -DMACH_IPC_COMPAT=0 -DSTANDALONE -DMACH -DPC532 -Dns532
CFLAGS = $(DEFINES) $(INCLUDES) -O
MIGFLAGS = $(MIGOPTS) $(DEFINES) $(INCLUDES)

CPP = /usr/local/lib/gcc-lib/pc532-mach/2.2.2/cpp
CC=gcc32k
AS=as32k
AR=ar32k
RANLIB=ranlib32k
MIG=/usr/local/pc532-mach/DIST/bin/mig

#OBJECTS = ${FUNCTIONS2/.*/&.o} ${FUNCTIONS3/.*/&.o}
OBJECTS = $(addsuffix .o, $(FUNCTIONS2)) $(addsuffix .o, $(FUNCTIONS3))

#MAN2PAGES = ${FUNCTIONS2}
#MAN3PAGES = ${FUNCTIONS3}

#include ${MAKETOP}Makefile-lib
#include ${MAKETOP}Makefile-man


libcmucs.a : ${OBJECTS}
	${RM} $@
	${AR} cq $@ ${OBJECTS}
	${RANLIB} $@
%.o: %.c
	$(CC) -c $(CFLAGS) -o $@ $<

%.o: %.s
	$(CPP) $(DEFINES) $(INCLUDES) $< > $*.as
	$(AS) -o $@ $*.as
	rm -f $*.as

%.o: %.ss
	$(AS) -o $@ $*.as

%.o: %.cs
	cp $< $*.S
	$(CPP) $(DEFINES) $(INCLUDES) $*.S > $*.as
	$(AS) -o $@ $*.as
	rm -f $*.S $*.as

# additional rules for the fopenp man page

#install :: ${INSTALLDIR}/man/man3/fopenp.3

#${INSTALLDIR}/man/man3/fopenp.3 : ${INSTALLDIR}/man/man3/openp.3
#	${RM} $@
#	ln $? $@

#release :: ${TRELEASEDIR}/man/man3/fopenp.3

#${TRELEASEDIR}/man/man3/fopenp.3 : ${TRELEASEDIR}/man/man3/openp.3
#	${RM} $@
#	ln $? $@

#clean ::
#	${RM} ${INSTALLDIR}/man/man3/fopenp.3

#-include Makedep
