Sun Dec 9 21:48:04 2012 UTC ()
handle the list of files and directories generated dynamically by configure


(christos)
diff -r1.64 -r1.65 src/tools/compat/Makefile

cvs diff -r1.64 -r1.65 src/tools/compat/Makefile (expand / switch to unified diff)

--- src/tools/compat/Makefile 2012/12/09 19:15:48 1.64
+++ src/tools/compat/Makefile 2012/12/09 21:48:04 1.65
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.64 2012/12/09 19:15:48 christos Exp $ 1# $NetBSD: Makefile,v 1.65 2012/12/09 21:48:04 christos Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
5HOSTLIB= nbcompat 5HOSTLIB= nbcompat
6 6
7SRCS= atoll.c basename.c cdbr.c cdbw.c dirname.c \ 7SRCS= atoll.c basename.c cdbr.c cdbw.c dirname.c \
8 fgetln.c flock.c fparseln.c fpurge.c \ 8 fgetln.c flock.c fparseln.c fpurge.c \
9 getcap.c getline.c getmode.c getopt_long.c gettemp.c \ 9 getcap.c getline.c getmode.c getopt_long.c gettemp.c \
10 heapsort.c \ 10 heapsort.c \
11 issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \ 11 issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \
12 md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \ 12 md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \
13 mi_vector_hash.c mkdtemp.c \ 13 mi_vector_hash.c mkdtemp.c \
14 mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \ 14 mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
@@ -66,60 +66,71 @@ _CURDIR:= ${.CURDIR} @@ -66,60 +66,71 @@ _CURDIR:= ${.CURDIR}
66.CURDIR:= ${_CURDIR} 66.CURDIR:= ${_CURDIR}
67 67
68SRCS:= ${SRCS:M*.c} 68SRCS:= ${SRCS:M*.c}
69 69
70config.cache: include/.stamp configure nbtool_config.h.in defs.mk.in 70config.cache: include/.stamp configure nbtool_config.h.in defs.mk.in
71 rm -f ${.TARGET} 71 rm -f ${.TARGET}
72 CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} LDFLAGS=${HOST_LDFLAGS:Q} \ 72 CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} LDFLAGS=${HOST_LDFLAGS:Q} \
73 ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache 73 ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache
74 74
75defs.mk: config.cache 75defs.mk: config.cache
76 @touch ${.TARGET} 76 @touch ${.TARGET}
77 77
78INCFILES= nbtool_config.h 78INCFILES= nbtool_config.h
79INCSUBDIRS= sys machine rpc arpa 79# Generate the list of include files generated by configure the ./ is so that
 80# the list is not empty.
 81_INCCONFFILES!= cd include && find . -name '*.h' && echo ./
 82INCCONFFILES= ${_INCCONFFILES:S@./@@}
 83INCSUBDIRS= ${INCCONFFILES:H:O:u:N.}
80CLEANDIRFILES+= ${INCFILES} 84CLEANDIRFILES+= ${INCFILES}
81 85
82# CLEANDIRFILES may not contain directory names 86# CLEANDIRFILES may not contain directory names
83cleandir: cleandir.include 87cleandir: cleandir.include
84cleandir.include: .PHONY 88cleandir.include: .PHONY
85 rm -rf include 89 rm -rf include
86 90
87include/.stamp: 91include/.stamp:
88 mkdir -p ${INCSUBDIRS:@d@ include/$d @} 92 mkdir -p ${INCSUBDIRS:@d@ include/$d @}
89 @touch ${.TARGET} 93 @touch ${.TARGET}
90 94
91# Install rules 95# Install rules
92 96
93HOST_LIBDIR= ${TOOLDIR}/lib 97HOST_LIBDIR= ${TOOLDIR}/lib
94HOST_INCSDIR= ${TOOLDIR}/include 98HOST_INCSDIR= ${TOOLDIR}/include
95HOST_SHAREDIR= ${TOOLDIR}/share 99HOST_SHAREDIR= ${TOOLDIR}/share
96 100
97install: .PHONY install.lib includes install.defs.mk 101install: .PHONY install.lib includes install.defs.mk
98 102
99# Install lib${HOSTLIB}.a in ${TOOLDIR}/lib 103# Install lib${HOSTLIB}.a in ${TOOLDIR}/lib
100install.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a 104install.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a
101${HOST_LIBDIR}/lib${HOSTLIB}.a: lib${HOSTLIB}.a 105${HOST_LIBDIR}/lib${HOSTLIB}.a: lib${HOSTLIB}.a
102 ${_MKTARGET_INSTALL} 106 ${_MKTARGET_INSTALL}
103 ${HOST_INSTALL_DIR} ${HOST_LIBDIR} 107 ${HOST_INSTALL_DIR} ${HOST_LIBDIR}
104 ${HOST_INSTALL_FILE} -m ${LIBMODE} ${.ALLSRC} ${.TARGET} 108 ${HOST_INSTALL_FILE} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
105 109
106.for _f in ${INCFILES} 110.for _f in ${INCFILES}
107HOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f} 111HOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f}
108${HOST_INCSDIR}/compat/${_f}: ${_f} 112${HOST_INCSDIR}/compat/${_f}: ${_f}
109 ${_MKTARGET_INSTALL} 113 ${_MKTARGET_INSTALL}
110 ${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET} 114 ${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
111.endfor 115.endfor
112 116
 117.for _f in ${INCCONFFILES}
 118HOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f}
 119${HOST_INCSDIR}/compat/${_f}: include/${_f}
 120 ${_MKTARGET_INSTALL}
 121 ${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
 122.endfor
 123
113.for _d in ${INCSUBDIRS} 124.for _d in ${INCSUBDIRS}
114HOST_INCINSTDIRS+= ${HOST_INCSDIR}/compat/${_d} 125HOST_INCINSTDIRS+= ${HOST_INCSDIR}/compat/${_d}
115${HOST_INCSDIR}/compat/${_d}: 126${HOST_INCSDIR}/compat/${_d}:
116 ${_MKTARGET_INSTALL} 127 ${_MKTARGET_INSTALL}
117 ${HOST_INSTALL_DIR} ${.TARGET} 128 ${HOST_INSTALL_DIR} ${.TARGET}
118.endfor 129.endfor
119 130
120# Install include files in ${TOOLDIR}/include/compat 131# Install include files in ${TOOLDIR}/include/compat
121includes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES} 132includes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES}
122 133
123# Install defs.mk in ${TOOLDIR}/share/compat 134# Install defs.mk in ${TOOLDIR}/share/compat
124install.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk 135install.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk
125${HOST_SHAREDIR}/compat/defs.mk: defs.mk 136${HOST_SHAREDIR}/compat/defs.mk: defs.mk