[BACK]Return to Makefile CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

File: [local] / src / usr.bin / make / Makefile (download)

Revision 1.18, Fri Jun 23 16:39:45 2000 UTC (23 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.17: +3 -3 lines

This patch is worth a lot, speed-wise.

This does introduce a proper stack of IFiles to handle included files:
instead of having the current file be a special case, it's also an IFile.

The corresponding code is slightly unobfuscated, removing the error-prone
ParseEOF function, freeing the filename systematically (thus, main.c needs
to strdup stdin), and merging both include functions lookup into one.

The speed gain comes from changing the IFile structure to merge with
fgetln seamlessly.

The low-level parse code is mostly moved to a new file, lowparse.c, to
make things easier to read (see next patch as well).

Accordingly, util.c gains a fgetln.

Note the interaction between Parse_File, Dir_FindFile, and ReadMakefile in
main.c. This patch closes a subtle memory hole (only the Makefile names,
so rather small).

Reviewed by miod@.

#	$OpenBSD: Makefile,v 1.18 2000/06/23 16:39:45 espie Exp $

PROG=	make
CFLAGS+= -I${.OBJDIR} -I${.CURDIR} -Wall -Wno-char-subscripts -Wno-unused -Wstrict-prototypes#-Wmissing-prototypes -Wstrict-prototypes

.if (${MACHINE_ARCH} == "m88k")
CFLAGS+=-O0
.endif

SRCS=	arch.c buf.c compat.c cond.c dir.c error.c for.c hash.c job.c lowparse.c \
	main.c make.c parse.c str.c suff.c targ.c var.c #util.c 
SRCS+=	lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
	lstConcatDestroy.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
	lstFindFrom.c lstForEachFrom.c \
	lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c \
	lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
.PATH:	${.CURDIR}/lst.lib


make: libohash.a
.PATH:  ${.CURDIR}/ohash
CFLAGS+=-I${.CURDIR}/ohash
LDADD=-L${.OBJDIR} -lohash

LIBOBJS= hash_create_entry.o hash_delete.o hash_do.o hash_entries.o \
    hash_enum.o hash_init.o hash_interval.o \
    hash_lookup_interval.o hash_lookup_memory.o hash_lookup_string.o \
    hash_qlookup.o hash_qlookupi.o

libohash.a: ${LIBOBJS}
	rm -f $@
	ar cq $@ `lorder ${LIBOBJS}|tsort`
	ranlib $@

CLEANFILES+=${LIBOBJS} libohash.a

beforedepend: hashconsts.h
# may need tweaking if you add variable synonyms or change the hash function
MAGICSLOTS=34

hashconsts.h: generate
	${.OBJDIR}/generate ${MAGICSLOTS} >${.TARGET}

generate: generate.o error.o libohash.a
	${CC} -o ${.TARGET} ${CFLAGS} ${.ALLSRC} ${LDADD}

# kludge for people who forget to make depend
${.CURDIR}/var.c: hashconsts.h

.if make(install)
SUBDIR+= PSD.doc
.endif

.include <bsd.prog.mk>