Home | History | Annotate | Line # | Download | only in make
Makefile revision 1.75
      1 #	$NetBSD: Makefile,v 1.75 2020/07/26 20:04:57 rillig Exp $
      2 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
      3 
      4 PROG=	make
      5 SRCS=	arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c lst.c main.c
      6 SRCS+=	make.c make_malloc.c metachar.c parse.c
      7 SRCS+=	str.c strlist.c suff.c targ.c trace.c var.c util.c
      8 
      9 USE_COVERAGE?=	no		# works only with gcc; clang9 fails to link
     10 .if ${USE_COVERAGE} == "yes"
     11 COPTS=		--coverage -O0 -ggdb
     12 LDADD=		--coverage
     13 CLEANFILES+=	${SRCS:.c=.gcda} ${SRCS:.c=.gcno} ${SRCS:=.gcov}
     14 .endif
     15 
     16 USE_META?=	yes
     17 .if ${USE_META:tl} != "no"
     18 
     19 SRCS+=		meta.c
     20 CPPFLAGS+=	-DUSE_META
     21 
     22 USE_FILEMON?=	ktrace
     23 .  if ${USE_FILEMON:tl} != "no"
     24 
     25 .PATH:	${.CURDIR}/filemon
     26 SRCS+=		filemon_${USE_FILEMON}.c
     27 CPPFLAGS+=	-DUSE_FILEMON
     28 CPPFLAGS+=	-DUSE_FILEMON_${USE_FILEMON:tu}
     29 
     30 .    if ${USE_FILEMON} == "dev"
     31 FILEMON_H?=	/usr/include/dev/filemon/filemon.h
     32 .      if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
     33 COPTS.filemon_dev.c+= \
     34 		-DHAVE_FILEMON_H -I${FILEMON_H:H}
     35 .      endif
     36 .    endif
     37 .  endif
     38 .endif
     39 
     40 SUBDIR.roff+=	PSD.doc
     41 .if make(obj) || make(clean)
     42 SUBDIR+=	unit-tests
     43 .endif
     44 
     45 ${SRCS:M*.c:.c=.o}: buf.h config.h dir.h hash.h job.h lst.h make.h make_malloc.h
     46 ${SRCS:M*.c:.c=.o}: meta.h metachar.h nonints.h pathnames.h sprite.h strlist.h trace.h
     47 
     48 .include <bsd.prog.mk>
     49 .include <bsd.subdir.mk>
     50 
     51 CPPFLAGS+=	-DMAKE_NATIVE
     52 COPTS.var.c+=	-Wno-cast-qual
     53 COPTS.job.c+=	-Wno-format-nonliteral
     54 COPTS.parse.c+=	-Wno-format-nonliteral
     55 COPTS.var.c+=	-Wno-format-nonliteral
     56 
     57 .if defined(TOOLDIR)
     58 # This is a native NetBSD build, use libutil rather than the local emalloc etc.
     59 CPPFLAGS+=	-DUSE_EMALLOC
     60 LDADD+=		-lutil
     61 DPADD+=		${LIBUTIL}
     62 .endif
     63 
     64 COPTS.arch.c+=	${GCC_NO_FORMAT_TRUNCATION}
     65 COPTS.dir.c+=	${GCC_NO_FORMAT_TRUNCATION}
     66 COPTS.main.c+=	${GCC_NO_FORMAT_TRUNCATION} ${GCC_NO_STRINGOP_TRUNCATION}
     67 COPTS.meta.c+=	${GCC_NO_FORMAT_TRUNCATION}
     68 COPTS.parse.c+=	${GCC_NO_FORMAT_TRUNCATION}
     69 
     70 # A simple unit-test driver to help catch regressions
     71 test: .MAKE
     72 	cd ${.CURDIR}/unit-tests \
     73 	&& MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
     74 .if ${USE_COVERAGE} == yes
     75 	gcov ${SRCS}
     76 .endif
     77 
     78 accept: .MAKE
     79 	cd ${.CURDIR}/unit-tests && ${.MAKE} ${.TARGET}
     80