Import bmake-20100808:
[pkgsrc.git] / devel / bmake / files / Makefile.in
1 #       $NetBSD: Makefile,v 1.50 2010/04/22 19:15:23 sjg Exp $
2 #       @(#)Makefile    5.2 (Berkeley) 12/28/90
3
4 #       $Id: Makefile.in,v 1.1.1.9 2010/09/07 14:11:16 joerg Exp $
5
6 PROG=   bmake
7 SRCS=   arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
8         make.c parse.c str.c suff.c targ.c trace.c var.c util.c 
9 SRCS+=  strlist.c
10 SRCS+=  make_malloc.c
11 SRCS+=  lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
12         lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
13         lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \
14         lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c lstLast.c \
15         lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
16 SRCS += lstPrev.c
17
18 # you can use this Makefile if you have an earlier version of bmake.
19 prefix= @prefix@
20 srcdir= @srcdir@
21 CC?= @CC@
22
23 # Base version on src date
24 MAKE_VERSION= 20100808
25 MACHINE=@machine@
26 MACHINE_ARCH=@machine_arch@
27 DEFAULT_SYS_PATH = @default_sys_path@
28
29 CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
30 CFLAGS+= -I. -I${srcdir} @DEFS@ @CPPFLAGS@ ${XDEFS} -DMAKE_NATIVE
31 CFLAGS+= ${CFLAGS_${.TARGET:T}} 
32 CFLAGS_main.o= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
33 LDFLAGS= @LDFLAGS@
34 LIBOBJS= @LIBOBJS@
35 LDADD= @LIBS@
36
37 .if !empty(LIBOBJS)
38 SRCS+= ${LIBOBJS:T:.o=.c}
39 .endif
40
41 .PATH:  ${srcdir}
42 .PATH:  ${srcdir}/lst.lib
43
44 OS!= uname -s
45 ARCH!= uname -p 2>/dev/null || uname -m
46
47 # list of OS's which are derrived from BSD4.4
48 isBSD44= NetBSD FreeBSD OpenBSD DragonFly
49
50 .if ${OS} == "NetBSD"
51 # Don't set these for anyone else since we don't know what the effect may be.
52 # On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
53 WFORMAT= 1
54 WARNS=4
55 .NOPATH: bmake.cat1
56 .if make(install) && exists(${DESTDIR}/usr/share/doc)
57 SUBDIR= PSD.doc
58 .endif
59 .endif
60
61 .if empty(isBSD44:M${OS})
62 # XXX not sure if we still want this given that configure
63 # lets us force or not the definition of MACHINE.
64 CFLAGS_main.o+= "-DFORCE_MACHINE=\"${MACHINE}\""
65 MANTARGET=cat
66 INSTALL?=${srcdir}/install-sh
67 .if (${MACHINE} == "sun386")
68 # even I don't have one of these anymore :-)
69 CFLAGS+= -DPORTAR
70 .elif (${MACHINE} != "sunos")
71 SRCS+= sigcompat.c
72 CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
73 .endif
74 .endif
75 .if make(obj) || make(clean)
76 SUBDIR+= unit-tests
77 .endif
78
79 # many systems use gcc these days
80 CC_IS_GCC=@GCC@
81 .if ${CC_IS_GCC} == "yes"
82 # problem with gcc3
83 CFLAGS_var.o+= -Wno-cast-qual
84 .endif
85
86 CFLAGS_main.o+= "-D@force_machine@MACHINE=\"${MACHINE}\"" "-DMACHINE_ARCH=\"${MACHINE_ARCH}\""
87
88 EXTRACT_MAN=no
89
90 MAN=${PROG}.1
91 .if (${PROG} != "make")
92 ${MAN}: make.1
93         @echo making ${PROG}.1
94         @sed -e '/^.Nm/s/make/${PROG}/' -e '/^.Sh HISTORY/,$$d' ${srcdir}/make.1 > $@
95         @(echo ".Sh HISTORY"; echo ".Nm"; echo "is derived from NetBSD's"; echo ".Xr make 1 ."; echo It uses autoconf to facilitate portability to other platforms.) >> $@
96
97 .endif
98
99 .if !empty(isBSD44:M${OS})
100 .if "${OS}" != "NetBSD" 
101 MAN1=${MAN}
102 .endif
103 MANTARGET?=man
104 .endif
105
106 MANTARGET?= cat
107 MANDEST?= ${MANDIR}/${MANTARGET}1
108
109 .if ${MANTARGET} == "cat"
110 _mfromdir=${srcdir}
111 .endif
112
113 .if exists(${srcdir}/../Makefile.inc)
114 .include "${srcdir}/../Makefile.inc"
115 .endif
116 .-include <bsd.prog.mk>
117 # sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
118 # so the inclusion below, results in complaints about re-defined
119 # targets.  For NetBSD though we need to explicitly include it.
120 .if defined(SUBDIR) && !target(${SUBDIR:[1]})
121 .-include <bsd.subdir.mk>
122 .endif
123
124 # Force these
125 BINDIR= ${prefix}/bin
126 MANDIR= ${prefix}/man
127
128 arch.o: config.h
129 # make sure that MAKE_VERSION gets updated.
130 main.o: ${SRCS} ${MAKEFILE}
131
132 MK?=${prefix}/share/mk
133 MKSRC?=@mksrc@
134 INSTALL?=${srcdir}/install-sh
135
136 beforeinstall:
137         test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
138         test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
139
140 # latest version of *.mk includes an installer.
141 # you should not need to  set USE_OS
142 install-mk:
143 .if exists(${MKSRC}/install-mk)
144         test -d ${DESTDIR}${MK} || ${INSTALL} -m 775 -d ${DESTDIR}${MK}
145         ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${MK} ${USE_OS}
146 .else
147         @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
148 .endif
149 CFLAGS_var.o += -Wno-cast-qual
150
151 .ifdef TOOLDIR
152 # this is a native netbsd build, 
153 # use libutil rather than the local emalloc etc.
154 CPPFLAGS+= -DUSE_EMALLOC
155 LDADD+=-lutil
156 DPADD+=${LIBUTIL}
157 .endif
158
159 # A simple unit-test driver to help catch regressions
160 accept test:
161         cd ${.CURDIR}/unit-tests && ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}