# $Source: /hpux/shared/supp//usr/src/cmd/make/./makefile,v $
# $Revision: 72.7 $

# Common makefile for the make utility.
# The rules.c file can be modified locally for people who still like
#	things like fortran.

# Define a temporary 7.0 flag for compiling in the VFORK changes
# in dosys and misc.  Take this out for 8.0, as the VFORK change
# will be rendered ineffective with the new kernel (copy on write)

FLAGS = -DVFORK -DBSD_SYS_MERGE

# Define usual objects

PROGRAM			= make
GENCAT			= gencat
CATFILE			= $(PROGRAM).cat
MSGFILES		= $(PROGRAM).msg

OBJECTS = doname.o misc.o files.o rules.o \
	  dosys.o gram.o dyndep.o prtmem.o nl_strchr.o filehash.o
SOURCES = main.c doname.c misc.c files.c rules.c \
	  dosys.c gram.c dyndep.c prtmem.c nl_strchr.c filehash.c
RELEASE = hpux_rel.o
RELEASE_C = hpux_rel.c

default:  make make.sbin make.9to10

metrics: make.M

make:  main.o $(OBJECTS) $(RELEASE)
	$(CC) -o make $(LDFLAGS) main.o $(OBJECTS) $(RELEASE) 
	$(GENCAT) $(CATFILE) $(MSGFILES)

make.9to10:  main_sbin.o $(OBJECTS) $(RELEASE)
	$(CC) -Wl,-a,archive -o make.9to10 $(LDFLAGS) main_sbin.o $(OBJECTS) $(RELEASE) /usr/lib/kern10stub.o

make.sbin:  main_sbin.o $(OBJECTS) $(RELEASE)
	$(CC) -Wl,-a,archive -o make.sbin $(LDFLAGS) main_sbin.o $(OBJECTS) $(RELEASE) 

make.M:  $(SOURCES) $(RELEASE_C)
	$(METRICS) -o make.M $(CFLAGS) $(SOURCES) $(RELEASE_C) 
	$(GENCAT) $(CATFILE) $(MSGFILES)

$(OBJECTS):  defs

clean:
	rm -f *.o

clobber: clean
	rm -f make make.M make.sbin $(CATFILE)

# temporarily for 7.0, redefine the .c.o rule to include the -DVFORK
# in the compilation of the .c files

.c.o:
	$(CC) -c $(CFLAGS) $(FLAGS) $*.c

main_sbin.o:
	$(CC) -D_NO_SETLOCALE -c $(CFLAGS) $(FLAGS) -o main_sbin.o main.c
