#sccs	"@(#)unixconv:Makefile	1.6"

include	$(MAKEINC)/Makepre.h
SHELL	= /bin/sh
#***************************************************************************
#                                                                          *
#		UNIX 5.0 Transition Aid (convert) makefile	 	   *
#									   *
#***************************************************************************
#                                                                          *
#		Header/Data Files					   *
#                                                                          *
#	inc/ar.h		archive file format header		   *
#	inc/a.out.h		machine language file format header        *
#	inc/sgs.h		sgs primitives				   *
#	com/old.a.out.h		pre 5.0 headers for a.out.h		   *
#	com/old.ar.h		pre 5.0 headers for ar.h		   *
#                                                                          *
#***************************************************************************
#                                                                          *
#		Source Code Files					   *
#								           *
#	com/convert.c		transition aid source code		   *
#									   *
#***************************************************************************

LPT = dpr -mx

OUTFIL = output.tmp

CDIR = .
USRINC	= $(INCROOT)/usr/include
SGSINC	= $(USRINC)/sgs
LLDFLAGS = -s
ID = id.o

OFILES = convert.o

CFILES = $(CDIR)/convert.c

DEPENDLIST = $(CFILES)

HFILES = $(USRINC)/ar.h $(USRINC)/aouthdr.h $(USRINC)/filehdr.h \
	 $(USRINC)/scnhdr.h $(USRINC)/linenum.h $(USRINC)/reloc.h \
	 $(USRINC)/syms.h $(USRINC)/sys/types.h $(USRINC)/sys/stat.h \
	 $(CDIR)/old.a.out.h $(CDIR)/old.ar.h $(SGSINC)/paths.h

LLD = -lld

#CFLAGS = -O 
#STRIP	= strip

FLEX	= -DFLEXNAMES

PPFLAGS = -I$(CDIR) -I$(SGSINC) -I$(USRINC) $(FLEX)


all:	Makeincludes convert

Makeincludes: $(DEPENDLIST)
	$(INCCMD) $(PPFLAGS) $(CFLAGS) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes; \
	$(MAKE)

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

convert: $(CFILES) $(HFILES) $(ID)
	$(CC) $(PPFLAGS) $(CFLAGS) $(LDFLAGS) $(CFILES) $(LLD) $(LDLIBS) $(ID) -o convert

install:
	$(INSTALL) -i$(EXITFLAG) convert%/bin $(INSDIR) $(PROTOFILE)


listing:
	pr -n makefile $(HFILES) $(CFILES) | $(LPT)
	@echo "files sent to lineprinter"

clean:
	-rm -f $(OFILES) id.[co]

flow:
	cflow $(PPFLAGS) $(CFILES) > $(OUTFIL)

flowr:
	cflow -r $(PPFLAGS) $(CFILES) > $(OUTFIL)

clobber: clean
	-rm -f convert

id.c: unixconv.sl
	mkslid > id.c

populate:
	getunit

include Makeincludes
include	$(MAKEINC)/Makepre.h
