#sccs	"@(#)make:Makefile	1.5"


include $(MAKEINC)/Makepre.h

# Description file for the Make command
# To build the Columbus make just type "make -f make.mk"
# For systems without the getu() system call type "make -f make.mk GETU="
# For pwb use
#	make -f make.mk GETU= RULES=pwbrules CFLAGS="-O -DPWB" LIBES=-lpw
# The rules.c file can be modified locally for people who still like
#	things like fortran.
# If the markfile is not present the compilation can be turned of with
#	"make -f make.mk MARKFILE="
# For people interested in finding out how the markfile is generated
# 	contact E. G. Bradford.

ID = id.o
YACCRM = rm -f
IFLAG = -i
RC =
LIBES = -lld
LDFLAGS = -s

#	There is an internal rule (rules.c) which can make
#	and object file "markfile.o" from "markfile" if the
#	"markfile" has a what(1) string in it.
#	Disable the $(MARKFILE) macro if the internal: rule
#	doesn't work on your system.

#	Turn off the GETU variable if your system does not have the
#	getu system call as documented in the CB unix manual.
GETU	=

#	RULES is defined to be the Columbus rules. It can be defined to
#	be the pwb rules by typing:
#		make -f make.mk RULES=pwbrules
#
RULES	= rules

#	For PWB systems the PWB define symbol must be in the CFLAGS macro.
#	Thus for pwb systems:
#	    make -f make.mk CFLAGS="-O -DPWB" GETU= RULES=pwbrules LIBES=-lpw
#	will make a version of "make" for PWB systems.

MARKOBJ=\
	markf.o

OBJECTS =  \
	main.o \
	doname.o \
	misc.o \
	files.o \
	$(RULES).o \
	dosys.o \
	gram.o \
	dyndep.o \
	prtmem.o

LCFLAGS = $(GETU)

DEPENDLIST = defs.h \
	files.c \
	gram.y \
	main.c \
	misc.c \
	doname.c \
	dosys.c \
	dyndep.c \
	perror.c \
	prtmem.c \
	rules.c

all:  Makeincludes make
	@echo MAKE is built.

Makeincludes: $(DEPENDLIST)
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes
	$(MAKE)

includes: $(DEPENDLIST)
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes

make:  $(OBJECTS) $(RC) $(LIBC) $(LIBLD) $(ID)
	$(CC) $(IFLAG) $(LDFLAGS) $(OBJECTS) $(LIBES) -o make $(ID)
	rm -f make.mini
	ln make make.mini

$(OBJECTS):  defs.h

install: 
	$(INSTALL) -i$(EXITFLAG) make $(INSDIR) $(PROTOFILE)

clean: 
	rm -f *.o

clobber: clean 
	rm -f make make.mini id.c
	$(YACCRM) gram.c

id.c: make.sl
	mkslid > id.c

populate:
	getunit

include Makeincludes
include $(MAKEINC)/Makepost.h
