#sccs	"@(#)uts/kern/cf:Makefile	1.13"

#	Convergent Technologies - System V - May 1983

include $(MAKEINC)/Makepre.h
include Makeflags
# at this point NAME=$(SYS)$(VERSION)
DEPENDLIST=conf.c linesw.c name.c low.s

OBJ=conf.o linesw.o name.o low.o

all:    Makeincludes id.o init ../$(NAME) 
	@-chmod 664 $(OBJ)
	$(SIZE) ../$(NAME)

id.c: ../../uts.sl
	mkslid >id.c

init:	xrest xname

xrest:
	cd ..; $(MAKE) -f Makefile

xname:
	@-$(CC) $(CFLAGS) -c \
		-DSYS=\"`expr $(SYS) : '\(.\{1,8\}\)'`\" \
		-DNODE=\"`expr $(NODE) : '\(.\{1,8\}\)'`\" \
		-DREL=\"`expr $(REL) : '\(.\{1,8\}\)'`\" \
		-DVER=\"`expr $(VERSION) : '\(.\{1,8\}\)'`\" \
		-DMACH=\"`expr $(MACH) : '\(.\{1,8\}\)'`\" \
		name.c

allconf:	xname ../$(NAME)

../$(NAME): $(OBJ) ../lib* ../locore.o
	$(LD) -x -N ifile.0407 -o ../$(NAME) low.o ../locore.o conf.o linesw.o ../lib* name.o id.o
#	$(SIZE) ../$(NAME)
#	$(NM) -xne ../$(NAME)|grep -v static > ../$(NAME).nm
#	-cut -c1-20 ../$(NAME).nm |pr -e -6 -w131 -h "alphabetic ../$(NAME).nm" >../$(NAME).code
#	$(NM) -xve ../$(NAME)|grep -v static|cut -c1-20|pr -e -6 -w131 -h "numeric ../$(NAME).nm" >>../$(NAME).code
	@-chmod 755 ../$(NAME)

conf.c low.s: master $(DFILE) config
	./config -m master $(DFILE)

config: config.c
	$(CC) $(CFLAGS) $(LDFLAGS) -s -o config config.c

clean:
	cd ..; $(MAKE) -f Makefile clean
	rm -f *.o

clobber:	clean
	cd ..; $(MAKE) -f Makefile clobber
	rm -f ../$(NAME) ../$(NAME).nm ../$(NAME).code low.s conf.c config id.c id.o

install: 
	cd ../sys; $(MAKE) install
	cd ../lwind; $(MAKE) install
	cd ..; $(INSTALL) -i$(EXITFLAG) $(NAME) $(INSDIR) $(PROTOFILE)
	$(INSTALL) -i$(EXITFLAG) master $(INSDIR) $(PROTOFILE)
	cd ../lddrv; $(MAKE) -f Makefile install

lint:
	cd ../Lint; $(MAKE) -f Makefile "CFLAGS=$(CFLAGS)"

populate:
	chmod +x kernel
	cd ..; echo "uts/kern" >.unit; echo "** uts/kern **:"; \
	getunit; $(MAKE) populate

FRC:

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

includes:	loc_includes
	cd ..; $(MAKE) -f Makefile includes

loc_includes: conf.c low.s
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes

include Makeincludes

nmprint:
	-cut -c3-22 ../$(NAME).nm |pr -e -6 -w132 -h "alphabetic ../$(NAME).nm" >../$(NAME).code
	$(NM) -hn ../$(NAME) |cut -c3-22|pr -e -6 -w132 -h "numeric ../$(NAME).nm" >>../$(NAME).code
