#sccs	"@(#)ar/mc68k:Makefile	1.4"

#***************************************************************************
#                                                                          *
#			UNIX Archive (ar) 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				   *
#                                                                          *
#***************************************************************************
#                                                                          *
#		Source Code Files					   *
#								           *
#	com/ar.c		archive source code			   *
#									   *
#***************************************************************************
include $(MAKEINC)/Makepre.h

ID = id.o
LPT = dpr -mx
OUTFIL = output.tmp
CDIR = ../common
LIBLD = -lld
OFILES = ar.o
CFILES = ar.c
PPFLAGS = -DAR32W
LCFLAGS =  -c $(PPFLAGS)
LDFLAGS =  -s
DEPENDLIST = $(CFILES)

all: Makeincludes ar ar.mini

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

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

ar.c: $(CDIR)/ar.c
	cp $(CDIR)/ar.c ar.c

ar:	$(OFILES) $(ID)
	$(LD) $(LDFLAGS) $(SHAREDLIB) $(OFILES) $(ID) -o ar $(LIBLD)

ar.mini: $(OFILES) $(ID)
	$(CC) $(LDFLAGS) $(OFILES) $(ID) -o ar.mini $(LIBLD)

install:
	$(INSTALL) -i$(EXITFLAG) ar $(INSDIR) $(PROTOFILE)
#	$(INSTALL) -i$(EXITFLAG) ar.mini $(INSDIR) $(PROTOFILE)

clean: 
	rm -f *.o

clobber: clean 
	rm -f ar.c ar ar.mini

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

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

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

populate:
	getunit

include Makeincludes
include $(MAKEINC)/Makepost.h
