#~!Makefile for Make4MPX
# Name:  Makefile Part No.: _______-____r
#
# Copyright 1995 - J B Systems, Morrison, CO
#
# The recipient of this product specifically agrees not to distribute,
# disclose, or disseminate in any way, to any one, nor use for its own
# benefit, or the benefit of others, any information contained  herein
# without the expressed written consent of J B Systems.
#
#                     RESTRICTED RIGHTS LEGEND
#
# Use, duplication, or disclosure by the Government is  subject  to
# restriction  as  set forth in paragraph (b) (3) (B) of the Rights
# in Technical Data and Computer Software  Clause  in  DAR  7-104.9
# (a).
#

#ident	"Make4MPX $Id: Makefile 1.2 1996/03/25 18:31:00 jbev Exp $"

TARGET = /system/bin
PREFIX =
BIN = /bin
UBIN = /usr/bin
LIB = /system/bin
SBIN = /system/bin
CPP = $(LIB)/$(PREFIX)cpp
CPFLAGS = -M -DMPX
CFLAGS = -DMPX
CC = $(UBIN)/$(PREFIX)cc $(CFLAGS)
MAKEFILE = Makefile

# Fill in with correct information

SRCS = ar.c cmprs.c dodep.c mkdep.c mkfile.c obd.c

MAINS = ar cmprs dodep mkdep mkfile
FILES = m.mpxmac mpxpre nbcas nbcc nbccom \
	nbcp1 nbcp2 nbcpp nblex nbyacc obd timezone
LINKS = basename cp chgrp chmod chown echo make mv rm \
	ci co ident merge rcs rcsmerge rcsdiff rlog
LINKS2 = diff sdiff cmp expr grep sum uniq nbcat \
	sed sh true false pwd touch date ln

ALL:	all

all:	$(MAKEFILE) $(MAINS)
	$(BIN)/echo MAKE4MPX is up to date.

ar:	ar.c
	$(CC) -O -o ar ar.c

cmprs:	cmprs.c
	$(CC) -O -o cmprs cmprs.c

dodep:	dodep.c
	$(CC) -O -o dodep dodep.c

mkdep:	mkdep.c
	$(CC) -O -o mkdep mkdep.c

mkfile:	mkfile.c
	$(CC) -O -o mkfile mkfile.c

obd:	obd.c
	$(CC) -O -o obd odb.c

CLEAN:  clean

clean:
	$(BIN)/rm -f $(MAINS)
	@if [ -d $(TARGET) ]; then \
	cd $(TARGET); \
	$(BIN)/rm -f $(MAINS); \
	$(BIN)/rm -f $(FILES); \
	$(BIN)/rm -f $(LINKS); \
	$(BIN)/rm -f $(LINKS2); \
	fi

	-$(BIN)/rmdir $(TARGET)

CLOBBER: clobber

clobber: clean

DEPEND: depend

depend: $(SRCS) $(MAKEFILE)
	$(SBIN)/dodep $(CPFLAGS) $(MAKEFILE) $(SRCS) >dep.out
	$(BIN)/mv dep.out $(MAKEFILE)

#depend: $(SRCS) $(MAKEFILE)
#	$(SBIN)/mkdep $(MAKEFILE) >dep.out
#	@for i in $(SRCS); do \
#	$(BIN)/echo "# Source file '$$i'" >> dep.out; \
#	$(CPP) $(CPFLAGS) $$i >> dep.out; \
#	done;
#	$(BIN)/echo "# End of dependencies" >> dep.out;
#	$(BIN)/mv dep.out $(MAKEFILE)

INSTALL: install

install: all
	@if [ -d /system/bin ]; then \
		echo "/system/bin already exists"; \
	else \
		mkdir /system/bin; \
	fi
	@if [ -f /system/bin/basename ]; then \
		rm -f /system/bin/basename; \
	fi
	ln -s /bin/basename /system/bin/basename

	@if [ -f /system/bin/cp ]; then \
		rm -f /system/bin/cp; \
	fi
	ln -s /bin/cp /system/bin/cp

	@if [ -f /system/bin/chgrp ]; then \
		rm -f /system/bin/chgrp; \
	fi
	ln -s /bin/chgrp /system/bin/chgrp

	@if [ -f /system/bin/chmod ]; then \
		rm -f /system/bin/chmod; \
	fi
	ln -s /bin/chmod /system/bin/chmod

	@if [ -f /system/bin/chown ]; then \
		rm -f /system/bin/chown; \
	fi
	ln -s /bin/chown /system/bin/chown

	@if [ -f /system/bin/echo ]; then \
		rm -f /system/bin/echo; \
	fi
	ln -s /bin/echo /system/bin/echo

	@if [ -f /system/bin/make ]; then \
		rm -f /system/bin/make; \
	fi
	ln -s /usr/bin/make /system/bin/make

	@if [ -f /system/bin/mv ]; then \
		rm -f /system/bin/mv; \
	fi
	ln -s /bin/mv /system/bin/mv

	@if [ -f /system/bin/rm ]; then \
		rm -f /system/bin/rm; \
	fi
	ln -s /bin/rm /system/bin/rm

	# rcs files
	@if [ -f /system/bin/ci ]; then \
		rm -f /system/bin/ci; \
	fi
	ln -s /usr/bin/ci /system/bin/ci

	@if [ -f /system/bin/co ]; then \
		rm -f /system/bin/co; \
	fi
	ln -s /usr/bin/co /system/bin/co

	@if [ -f /system/bin/ident ]; then \
		rm -f /system/bin/ident; \
	fi
	ln -s /usr/bin/ident /system/bin/ident

	@if [ -f /system/bin/merge ]; then \
		rm -f /system/bin/merge; \
	fi
	ln -s /usr/bin/merge /system/bin/merge

	@if [ -f /system/bin/rcs ]; then \
		rm -f /system/bin/rcs; \
	fi
	ln -s /usr/bin/rcs /system/bin/rcs

	@if [ -f /system/bin/rcsmerge ]; then \
		rm -f /system/bin/rcsmerge; \
	fi
	ln -s /usr/bin/rcsmerge /system/bin/rcsmerge

	@if [ -f /system/bin/rcsdiff ]; then \
		rm -f /system/bin/rcsdiff; \
	fi
	ln -s /usr/bin/rcsdiff /system/bin/rcsdiff

	@if [ -f /system/bin/rlog ]; then \
		rm -f /system/bin/rlog; \
	fi
	ln -s /usr/bin/rlog /system/bin/rlog

	# end of rcs files

	@if [ -f /system/bin/diff ]; then \
		rm -f /system/bin/diff; \
	fi
	ln -s /usr/bin/diff /system/bin/diff

	@if [ -f /system/bin/cmp ]; then \
		rm -f /system/bin/cmp; \
	fi
	ln -s /usr/bin/cmp /system/bin/cmp

	@if [ -f /system/bin/sdiff ]; then \
		rm -f /system/bin/sdiff; \
	fi
	ln -s /usr/bin/sdiff /system/bin/sdiff

	@if [ -f /system/bin/expr ]; then \
		rm -f /system/bin/expr; \
	fi
	ln -s /usr/bin/expr /system/bin/expr

	@if [ -f /system/bin/grep ]; then \
		rm -f /system/bin/grep; \
	fi
	ln -s /usr/bin/grep /system/bin/grep

	@if [ -f /system/bin/sum ]; then \
		rm -f /system/bin/sum; \
	fi
	ln -s /usr/bin/sum /system/bin/sum

	@if [ -f /system/bin/uniq ]; then \
		rm -f /system/bin/uniq; \
	fi
	ln -s /usr/bin/uniq /system/bin/uniq

	@if [ -f /system/bin/nbcat ]; then \
		rm -f /system/bin/nbcat; \
	fi
	ln -s /bin/echo /system/bin/nbcat

	@if [ -f /system/bin/sed ]; then \
		rm -f /system/bin/sed; \
	fi
	ln -s /bin/sed /system/bin/sed

	@if [ -f /system/bin/sh ]; then \
		rm -f /system/bin/sh; \
	fi
	ln -s /bin/sh /system/bin/sh

	@if [ -f /system/bin/true ]; then \
		rm -f /system/bin/true; \
	fi
	ln -s /bin/true /system/bin/true

	@if [ -f /system/bin/false ]; then \
		rm -f /system/bin/false; \
	fi
	ln -s /bin/false /system/bin/false

	@if [ -f /system/bin/pwd ]; then \
		rm -f /system/bin/pwd; \
	fi
	ln -s /bin/pwd /system/bin/pwd

	@if [ -f /system/bin/touch ]; then \
		rm -f /system/bin/touch; \
	fi
	ln -s /bin/touch /system/bin/touch

	@if [ -f /system/bin/date ]; then \
		rm -f /system/bin/date; \
	fi
	ln -s /bin/date /system/bin/date

	@if [ -f /system/bin/ln ]; then \
		rm -f /system/bin/ln; \
	fi
	ln -s /bin/ln /system/bin/ln

	$(BIN)/cp $(MAINS) $(TARGET)
	$(BIN)/cp $(FILES) $(TARGET)

# DO NOT DELETE THIS LINE -- the dependencies begin here
# Source file ar.c
ar.o: ar.c
ar.o: /system/nbinclude/stdio.h
ar.o: /system/nbinclude/sys/fcntl.h
ar.o: /system/nbinclude/sys/types.h
ar.o: /system/nbinclude/sys/stat.h
ar.o: /system/nbinclude/types.h
ar.o: /system/nbinclude/string.h
ar.o: /system/nbinclude/ctype.h
# Source file cmprs.c
cmprs.o: cmprs.c
cmprs.o: /system/nbinclude/stdio.h
cmprs.o: /system/nbinclude/sys/fcntl.h
cmprs.o: /system/nbinclude/sys/types.h
cmprs.o: /system/nbinclude/sys/stat.h
cmprs.o: /system/nbinclude/types.h
cmprs.o: /system/nbinclude/string.h
cmprs.o: /system/nbinclude/ctype.h
cmprs.o: /system/nbinclude/unixio.h
cmprs.o: /system/nbinclude/mosde.h
cmprs.o: /system/nbinclude/stdio.h
# Source file dodep.c
dodep.o: dodep.c
dodep.o: /system/nbinclude/stdio.h
# Source file mkdep.c
mkdep.o: mkdep.c
mkdep.o: /system/nbinclude/stdio.h
# Source file mkfile.c
mkfile.o: mkfile.c
mkfile.o: /system/nbinclude/stdio.h
mkfile.o: /system/nbinclude/sys/fcntl.h
mkfile.o: /system/nbinclude/sys/types.h
mkfile.o: /system/nbinclude/sys/stat.h
mkfile.o: /system/nbinclude/types.h
mkfile.o: /system/nbinclude/string.h
mkfile.o: /system/nbinclude/ctype.h
# Source file obd.c
obd.o: obd.c
obd.o: /system/nbinclude/stdio.h
obd.o: /system/nbinclude/fcntl.h
obd.o: /system/nbinclude/stdio.h
# End of dependencies
