| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: Makefile.gnuhost,v 1.36 2012/01/20 23:01:05 christos Exp $ | | 1 | # $NetBSD: Makefile.gnuhost,v 1.37 2012/01/21 22:31:15 christos Exp $ |
2 | # | | 2 | # |
3 | # Rules used when building a GNU host package. Expects MODULE to be set. | | 3 | # Rules used when building a GNU host package. Expects MODULE to be set. |
4 | # | | 4 | # |
5 | # There's not a lot we can do to build reliably in the face of many | | 5 | # There's not a lot we can do to build reliably in the face of many |
6 | # available configuration options. To be as low-overhead as possible, | | 6 | # available configuration options. To be as low-overhead as possible, |
7 | # we follow the following scheme: | | 7 | # we follow the following scheme: |
8 | # | | 8 | # |
9 | # * Configuration is only re-run when an autoconf source file (such as | | 9 | # * Configuration is only re-run when an autoconf source file (such as |
10 | # "configure" or "config.sub") is changed. | | 10 | # "configure" or "config.sub") is changed. |
11 | # | | 11 | # |
12 | # * "config.status" is run to rebuild Makefiles and .h files if an | | 12 | # * "config.status" is run to rebuild Makefiles and .h files if an |
13 | # autoconf-parsed file (such as Makefile.in) is changed. | | 13 | # autoconf-parsed file (such as Makefile.in) is changed. |
14 | # | | 14 | # |
| @@ -97,36 +97,26 @@ MAKE_ARGS+= BISON=true DESTDIR= INSTALL= | | | @@ -97,36 +97,26 @@ MAKE_ARGS+= BISON=true DESTDIR= INSTALL= |
97 | ALL_TARGET?= all | | 97 | ALL_TARGET?= all |
98 | INSTALL_TARGET?=install | | 98 | INSTALL_TARGET?=install |
99 | | | 99 | |
100 | BUILD_PLATFORM!= uname -srm | tr ' ' '-' | | 100 | BUILD_PLATFORM!= uname -srm | tr ' ' '-' |
101 | CONFIGURE_PLATFORM!= if [ -s .configure_done ]; then cat .configure_done; else echo none; fi | | 101 | CONFIGURE_PLATFORM!= if [ -s .configure_done ]; then cat .configure_done; else echo none; fi |
102 | .if "${BUILD_PLATFORM}" != "${CONFIGURE_PLATFORM}" | | 102 | .if "${BUILD_PLATFORM}" != "${CONFIGURE_PLATFORM}" |
103 | configure_cleanup: | | 103 | configure_cleanup: |
104 | @mkdir build 2>/dev/null || true | | 104 | @mkdir build 2>/dev/null || true |
105 | @(echo "Cleaning stale cache files ${BUILD_PLATFORM} != ${CONFIGURE_PLATFORM}") | | 105 | @(echo "Cleaning stale cache files ${BUILD_PLATFORM} != ${CONFIGURE_PLATFORM}") |
106 | @(cd build && find . -name config.cache -print0 | xargs -0 rm -f) | | 106 | @(cd build && find . -name config.cache -print0 | xargs -0 rm -f) |
107 | configure_cleanup=configure_cleanup | | 107 | configure_cleanup=configure_cleanup |
108 | .endif | | 108 | .endif |
109 | | | 109 | |
110 | BUILD_PLATFORM!= uname -srm | tr ' ' '-' | | | |
111 | CONFIGURE_PLATFORM!= if [ -s .configure_done ]; then cat .configure_done; else echo none; fi | | | |
112 | .if "${BUILD_PLATFORM}" != "${CONFIGURE_PLATFORM}" | | | |
113 | configure_cleanup: | | | |
114 | @mkdir build 2>/dev/null || true | | | |
115 | @(echo "Cleaning stale cache files ${BUILD_PLATFORM} != ${CONFIGURE_PLATFORM}") | | | |
116 | @(cd build && find . -name config.cache -print0 | xargs -0 rm -f) | | | |
117 | configure_cleanup=configure_cleanup | | | |
118 | .endif | | | |
119 | | | | |
120 | .configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup} | | 110 | .configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup} |
121 | @mkdir build 2>/dev/null || true | | 111 | @mkdir build 2>/dev/null || true |
122 | @(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS}) | | 112 | @(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS}) |
123 | @echo ${BUILD_PLATFORM} > $@ | | 113 | @echo ${BUILD_PLATFORM} > $@ |
124 | | | 114 | |
125 | # The .build_done timestamp is only updated if a file actually changes | | 115 | # The .build_done timestamp is only updated if a file actually changes |
126 | # in the build tree during "make all". This way, if nothing has changed, | | 116 | # in the build tree during "make all". This way, if nothing has changed, |
127 | # a "make install MKUPDATE=yes" will do nothing. | | 117 | # a "make install MKUPDATE=yes" will do nothing. |
128 | | | 118 | |
129 | .build_done: .configure_done | | 119 | .build_done: .configure_done |
130 | @(cd build && ${BUILD_COMMAND} ${ALL_TARGET}) | | 120 | @(cd build && ${BUILD_COMMAND} ${ALL_TARGET}) |
131 | @if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \ | | 121 | @if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \ |
132 | then touch $@; fi | | 122 | then touch $@; fi |