# A Not so Simple Makefile - Written by K London 3/8/93
# (C) Borg Enterprises 1993

# Which C compiler
CC= gcc

# Debugging or Optimisation
O= -O6

# Define the CFLAGS
# Use the line below if you have setenv() in your system library
#CFLAGS= -I. $O -DHAVESETENV
CFLAGS= -I. $O

# Define the Libraries you need.
LIBS= 

# Define the name of the lst.lib
LSTLIB= lst.lib/lst.lib.a

# Define the name of the support lib
SUPLIB= support/support.a

# What OBJS are needed for pmake
OBJS=	arch.o buf.o compat.o cond.o dir.o hash.o job.o make.o main.o parse.o \
	str.o suff.o targ.o var.o

pmake: ${OBJS} ${LSTLIB} ${SUPLIB}
	${CC} -o pmake ${OBJS} ${LSTLIB} ${LIBS}

lst.lib/lst.lib.a:
	cd lst.lib; ${MAKE} -f Makefile.dist CFLAGS='$(CFLAGS) -I..' all

support/support.a:
	cd support; ${MAKE} -f Makefile.dist CFLAGS='$(CFLAGS) -I..' all

all: pmake

install: all
	cp pmake /usr/local/bin/pmake
	chmod a+x,go-rw /usr/local/bin/pmake
	mkdir -p /usr/share/mk
	chmod a+rx /usr/share
	chmod a+rx /usr/share/mk
	cp mk/* /usr/share/mk
	chmod a+rx /usr/share/mk/*

clean:
	rm -f ${OBJS} core pmake 
	cd lst.lib; ${MAKE} -f Makefile.dist clean
	cd support; ${MAKE} -f Makefile.dist clean

# From here down are the new dependencies
arch.o : arch.c make.h sprite.h lst.h config.h nonints.h hash.h
buf.o : buf.c sprite.h buf.h 
compat.o : compat.c make.h sprite.h lst.h config.h nonints.h 
cond.o : cond.c make.h sprite.h lst.h config.h nonints.h
dir.o : dir.c make.h sprite.h lst.h config.h nonints.h hash.h 
hash.o : hash.c sprite.h hash.h 
job.o : job.c make.h sprite.h lst.h config.h nonints.h job.h pathnames.h 
make.o : make.c make.h sprite.h lst.h config.h nonints.h 
main.o : main.c make.h sprite.h lst.h config.h nonints.h pathnames.h
parse.o : parse.c make.h sprite.h lst.h config.h nonints.h buf.h pathnames.h 
str.o : str.c make.h sprite.h lst.h config.h nonints.h 
suff.o : suff.c make.h sprite.h lst.h config.h nonints.h bit.h 
targ.o : targ.c make.h sprite.h lst.h config.h nonints.h hash.h 
var.o : var.c make.h sprite.h lst.h config.h nonints.h buf.h 

