| @@ -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 | |
5 | HOSTLIB= nbcompat | | 5 | HOSTLIB= nbcompat |
6 | | | 6 | |
7 | SRCS= atoll.c basename.c cdbr.c cdbw.c dirname.c \ | | 7 | SRCS= 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 | |
68 | SRCS:= ${SRCS:M*.c} | | 68 | SRCS:= ${SRCS:M*.c} |
69 | | | 69 | |
70 | config.cache: include/.stamp configure nbtool_config.h.in defs.mk.in | | 70 | config.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 | |
75 | defs.mk: config.cache | | 75 | defs.mk: config.cache |
76 | @touch ${.TARGET} | | 76 | @touch ${.TARGET} |
77 | | | 77 | |
78 | INCFILES= nbtool_config.h | | 78 | INCFILES= nbtool_config.h |
79 | INCSUBDIRS= 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 ./ |
| | | 82 | INCCONFFILES= ${_INCCONFFILES:S@./@@} |
| | | 83 | INCSUBDIRS= ${INCCONFFILES:H:O:u:N.} |
80 | CLEANDIRFILES+= ${INCFILES} | | 84 | CLEANDIRFILES+= ${INCFILES} |
81 | | | 85 | |
82 | # CLEANDIRFILES may not contain directory names | | 86 | # CLEANDIRFILES may not contain directory names |
83 | cleandir: cleandir.include | | 87 | cleandir: cleandir.include |
84 | cleandir.include: .PHONY | | 88 | cleandir.include: .PHONY |
85 | rm -rf include | | 89 | rm -rf include |
86 | | | 90 | |
87 | include/.stamp: | | 91 | include/.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 | |
93 | HOST_LIBDIR= ${TOOLDIR}/lib | | 97 | HOST_LIBDIR= ${TOOLDIR}/lib |
94 | HOST_INCSDIR= ${TOOLDIR}/include | | 98 | HOST_INCSDIR= ${TOOLDIR}/include |
95 | HOST_SHAREDIR= ${TOOLDIR}/share | | 99 | HOST_SHAREDIR= ${TOOLDIR}/share |
96 | | | 100 | |
97 | install: .PHONY install.lib includes install.defs.mk | | 101 | install: .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 |
100 | install.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a | | 104 | install.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} |
107 | HOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f} | | 111 | HOST_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} |
| | | 118 | HOST_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} |
114 | HOST_INCINSTDIRS+= ${HOST_INCSDIR}/compat/${_d} | | 125 | HOST_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 |
121 | includes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES} | | 132 | includes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES} |
122 | | | 133 | |
123 | # Install defs.mk in ${TOOLDIR}/share/compat | | 134 | # Install defs.mk in ${TOOLDIR}/share/compat |
124 | install.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk | | 135 | install.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk |
125 | ${HOST_SHAREDIR}/compat/defs.mk: defs.mk | | 136 | ${HOST_SHAREDIR}/compat/defs.mk: defs.mk |