buildsys  Check-in [a5e752277c]

Overview
Comment:Keep .dep files to avoid unnecessary regeneration

This prevents regenerating all dependencies even when only a single file
was changed, which can be prohibitively expensive.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a5e752277ce1b3c7a65507ce6626756fa9b09f97dc5c8ea64f2f357fe0b49caf
User & Date: js on 2020-02-18 01:47:54
Other Links: manifest | tags
Context
2020-02-18
21:57
Eliminate dependency generation step entirely check-in: b7980e9839 user: js tags: trunk
01:47
Keep .dep files to avoid unnecessary regeneration check-in: a5e752277c user: js tags: trunk
2018-11-10
10:55
Do not use - prefix to suppress errors check-in: 4f0b91a23e user: js tags: trunk
Changes

Modified buildsys.mk.in from [a8f559e708] to [6e5d4b1c78].

1
2
3
4


5
6

7
8
9
10
11
12
13
1
2


3
4
5

6
7
8
9
10
11
12
13


-
-
+
+

-
+







#
#  Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
#                2017, 2018
#    Jonathan Schleifer <js@heap.zone>
#                2017, 2018, 2020
#    Jonathan Schleifer <js@nil.im>
#
#  https://heap.zone/git/?p=buildsys.git
#  https://git.nil.im/buildsys.git
#
#  Permission to use, copy, modify, and/or distribute this software for any
#  purpose with or without fee is hereby granted, provided that the above
#  copyright notice and this permission notice is present in all copies.
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
105
106
107
108
109
110
111






112
113
114
115
116
117
118
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124







+
+
+
+
+
+







OBJS6 = ${OBJS5:.java=.class}
OBJS7 = ${OBJS6:.m=.o}
OBJS8 = ${OBJS7:.mm=.o}
OBJS9 = ${OBJS8:.py=.pyc}
OBJS10 = ${OBJS9:.rc=.o}
OBJS11 = ${OBJS10:.S=.o}
OBJS += ${OBJS11:.xpm=.o}
DEPS1 = ${SRCS:.c=.c.dep}
DEPS2 = ${DEPS1:.cc=.cc.dep}
DEPS3 = ${DEPS2:.cxx=.cxx.dep}
DEPS4 = ${DEPS3:.m=.m.dep}
DEPS5 = ${DEPS4:.mm=.mm.dep}
DEPS = ${DEPS5:.S=.S.dep}

LIB_OBJS = ${OBJS:.o=.lib.o}
AMIGA_LIB_OBJS = ${OBJS:.o=.amigalib.o}
PLUGIN_OBJS = ${OBJS:.o=.plugin.o}

MO_FILES = ${LOCALES:.po=.mo}

137
138
139
140
141
142
143
144
145
146
147
148
149
150








151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171






































172
173
174
175
176
177






178
179
180
181
182
183
184






185
186

187
188
189
190

191
192
193


194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
143
144
145
146
147
148
149







150
151
152
153
154
155
156
157





















158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195






196
197
198
199
200
201







202
203
204
205
206
207
208

209

210
211

212

213
214
215
216
217
218

























219
220
221
222
223
224
225







-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+

-
+
-


-
+
-


+
+


-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







${SUBDIRS} ${SUBDIRS_AFTER}:
	for i in $@; do \
		${DIR_ENTER}; \
		${MAKE} || exit $$?; \
		${DIR_LEAVE}; \
	done

depend: pre-depend ${SRCS}
	regen=0; \
	deps=""; \
	test -f .deps || regen=1; \
	for i in "" ${SRCS}; do \
		case $$i in \
			"") \
depend: pre-depend .deps

.deps: ${DEPS}
	: >.deps
	for i in $${DEPS}; do \
		echo "include $$i" >>.deps; \
	done

				;; \
			*.c) \
				if test x"${CC_DEPENDS}" = x"yes"; then \
					test $$i -nt .deps && regen=1; \
					deps="$$deps $$i.dep"; \
				fi; \
				;; \
			*.cc | *.cxx) \
				if test x"${CXX_DEPENDS}" = x"yes"; then \
					test $$i -nt .deps && regen=1; \
					deps="$$deps $$i.dep"; \
				fi; \
				;; \
			*.m) \
				if test x"${OBJC_DEPENDS}" = x"yes"; then \
					test $$i -nt .deps && regen=1; \
					deps="$$deps $$i.dep"; \
				fi; \
				;; \
			*.mm) \
				if test x"${OBJCXX_DEPENDS}" = x"yes"; then \
.c.c.dep:
	if test x"${CC_DEPENDS}" = x"yes"; then \
		${DEPEND_STATUS}; \
		if ${CPP} ${CPPFLAGS} ${CFLAGS} -M $< | sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@; then \
			${DEPEND_OK}; \
		else \
			rm -f $@; false; \
			${DEPEND_FAILED}; \
		fi; \
	else \
		: >$@; \
	fi
.cc.cc.dep .cxx.cxx.dep:
	if test x"${CXX_DEPENDS}" = x"yes"; then \
		${DEPEND_STATUS}; \
		if ${CPP} ${CPPFLAGS} ${CXXFLAGS} -M $< | sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@; then \
			${DEPEND_OK}; \
		else \
			rm -f $@; false; \
			${DEPEND_FAILED}; \
		fi; \
	else \
		: >$@; \
	fi
.m.m.dep:
	if test x"${OBJC_DEPENDS}" = x"yes"; then \
		${DEPEND_STATUS}; \
		if ${CPP} ${CPPFLAGS} ${OBJCFLAGS} -M $< | sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@; then \
			${DEPEND_OK}; \
		else \
			rm -f $@; false; \
			${DEPEND_FAILED}; \
		fi; \
	else \
		: >$@; \
	fi
.mm.mm.dep:
	if test x"${OBJCXX_DEPENDS}" = x"yes"; then \
					test $$i -nt .deps && regen=1; \
					deps="$$deps $$i.dep"; \
				fi; \
				;; \
			*.S) \
				if test x"${AS_DEPENDS}" = x"yes"; then \
		${DEPEND_STATUS}; \
		if ${CPP} ${CPPFLAGS} ${OBJCPPFLAGS} -M $< | sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@; then \
			${DEPEND_OK}; \
		else \
			rm -f $@; false; \
			${DEPEND_FAILED}; \
					test $$i -nt .deps && regen=1; \
					deps="$$deps $$i.dep"; \
				fi; \
				;; \
		esac; \
	done; \
	if test x"$$regen" = x"1" -a x"$$deps" != x""; then \
		fi; \
	else \
		: >$@; \
	fi
.S.S.dep:
	if test x"${AS_DEPENDS}" = x"yes"; then \
		${DEPEND_STATUS}; \
		if ${MAKE} $$deps && cat $$deps >.deps; then \
		if ${CPP} ${CPPFLAGS} ${ASFLAGS} -M $< | sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@; then \
			rm -f $$deps; \
			${DEPEND_OK}; \
		else \
			:> .deps; \
			rm -f $@; false; \
			touch -t 0001010000 .deps; \
			${DEPEND_FAILED}; \
		fi; \
	else \
		: >$@; \
	fi

.c.c.dep:
	${CPP} ${CPPFLAGS} ${CFLAGS} -M $< | \
	sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@ || \
	{ rm -f $@; false; }

.cc.cc.dep .cxx.cxx.dep:
	${CPP} ${CPPFLAGS} ${CXXFLAGS} -M $< | \
	sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@ || \
	{ rm -f $@; false; }

.m.m.dep:
	${CPP} ${CPPFLAGS} ${OBJCFLAGS} -M $< | \
	sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@ || \
	{ rm -f $@; false; }

.mm.mm.dep:
	${CPP} ${CPPFLAGS} ${OBJCPPFLAGS} -M $< | \
	sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@ || \
	{ rm -f $@; false; }

.S.S.dep:
	${CPP} ${CPPFLAGS} ${ASFLAGS} -M $< | \
	sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.amigalib.o \1.plugin.o:/' >$@ || \
	{ rm -f $@; false; }

pre-depend:

${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS} ${OBJS_EXTRA}
	${LINK_STATUS}
	out="$@"; \
	if ${LD} -o $@ ${OBJS} ${OBJS_EXTRA} ${LDFLAGS} ${LIBS}; then \
		${LINK_OK}; \
256
257
258
259
260
261
262
263

264
265
266
267
268
269
270
254
255
256
257
258
259
260

261
262
263
264
265
266
267
268







-
+








${FRAMEWORK} ${FRAMEWORK_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA}
	${LINK_STATUS}
	out="$@"; \
	if rm -fr $$out && ${MKDIR_P} $$out && ${MAKE} COPY_HEADERS_IF_SUBDIR=${includesubdir} COPY_HEADERS_DESTINATION=$$PWD/$@/Headers copy-headers-into-framework && if test -f Info.plist; then ${INSTALL} -m 644 Info.plist $$out/Info.plist; fi && if test -f module.modulemap; then ${MKDIR_P} $$out/Modules && ${INSTALL} -m 644 module.modulemap $$out/Modules/module.modulemap; fi && ${LD} -o $$out/$${out%.framework} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${FRAMEWORK_LDFLAGS} ${FRAMEWORK_LDFLAGS_INSTALL_NAME} ${LDFLAGS} ${FRAMEWORK_LIBS} && ${CODESIGN} -fs ${CODESIGN_IDENTITY} --timestamp=none $$out; then \
		${LINK_OK}; \
	else \
		rm -fr $$out; \
		rm -fr $$out; false; \
		${LINK_FAILED}; \
	fi

copy-headers-into-framework:
	for i in "" ${SUBDIRS} ${SUBDIRS_AFTER}; do \
		test x"$$i" = x"" && continue; \
		cd $$i || exit 1; \
290
291
292
293
294
295
296
297

298
299
300
301
302
303
304
305
306
307

308
309
310
311
312
313
314
315
316
288
289
290
291
292
293
294

295
296
297
298
299
300
301
302
303
304
305
306
307

308
309
310
311
312
313
314







-
+










+

-








${PLUGIN} ${PLUGIN_NOINST}: ${EXT_DEPS} ${PLUGIN_OBJS}
	${LINK_STATUS}
	out="$@"; \
	if @LINK_PLUGIN@; then \
		${LINK_OK}; \
	else \
		rm -fr $$out; \
		rm -fr $$out; false; \
		${LINK_FAILED}; \
	fi

${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS} ${OBJS_EXTRA}
	${LINK_STATUS}
	rm -f $@
	if test x"${BUILD_AND_HOST_ARE_DARWIN}" = x"yes"; then \
		if /usr/bin/libtool -static -o $@ ${OBJS} ${OBJS_EXTRA}; then \
			${LINK_OK}; \
		else \
			rm -f $@; false; \
			${LINK_FAILED}; \
			rm -f $@; \
		fi; \
	else \
		out="$@"; \
		objs=""; \
		ars=""; \
		for i in ${OBJS} ${OBJS_EXTRA}; do \
			case $$i in \
332
333
334
335
336
337
338

339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354

355
356
357
358
359
360
361
362
363
330
331
332
333
334
335
336
337
338

339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354

355
356
357
358
359
360
361







+

-














+

-







				objs="$$objs $$dir/$$j"; \
			done; \
			cd ..; \
		done; \
		if ${AR} cr $@ $$objs && ${RANLIB} $@; then \
			${LINK_OK}; \
		else \
			rm -f $@; false; \
			${LINK_FAILED}; \
			rm -f $@; \
		fi; \
		for i in $$ars; do \
			dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
			rm -fr $$dir; \
		done; \
	fi

${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA}
	${LINK_STATUS}
	rm -f $@
	if test x"${BUILD_AND_HOST_ARE_DARWIN}" = x"yes"; then \
		if /usr/bin/libtool -static -o $@ ${LIB_OBJS} ${LIB_OBJS_EXTRA}; then \
			${LINK_OK}; \
		else \
			rm -f $@; false; \
			${LINK_FAILED}; \
			rm -f $@; \
		fi; \
	else \
		out="$@"; \
		objs=""; \
		ars=""; \
		for i in ${LIB_OBJS} ${LIB_OBJS_EXTRA}; do \
			case $$i in \
379
380
381
382
383
384
385

386
387
388
389
390
391
392
393
394
377
378
379
380
381
382
383
384
385

386
387
388
389
390
391
392







+

-







				objs="$$objs $$dir/$$j"; \
			done; \
			cd ..; \
		done; \
		if ${AR} cr $@ $$objs && ${RANLIB} $@; then \
			${LINK_OK}; \
		else \
			rm -f $@; false; \
			${LINK_FAILED}; \
			rm -f $@; \
		fi; \
		for i in $$ars; do \
			dir=".$$(echo $$i | sed 's/\//_/g').objs"; \
			rm -fr $$dir; \
		done; \
	fi

907
908
909
910
911
912
913
914

915
916
917
918
919
920
921
905
906
907
908
909
910
911

912
913
914
915
916
917
918
919







-
+







	for i in "" ${SUBDIRS} ${SUBDIRS_AFTER}; do \
		test x"$$i" = x"" && continue; \
		${DIR_ENTER}; \
		${MAKE} clean || exit $$?; \
		${DIR_LEAVE}; \
	done

	for i in "" ${DEPS} ${OBJS} ${OBJS_EXTRA} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_EXTRA} ${PLUGIN_OBJS} ${PROG} ${PROG_NOINST} ${SHARED_LIB} ${SHARED_LIB_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${FRAMEWORK} ${PLUGIN} ${PLUGIN_NOINST} ${CLEAN_LIB} ${MO_FILES} ${CLEAN}; do \
	for i in "" ${DEPS} ${OBJS} ${OBJS_EXTRA} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_EXTRA} ${PLUGIN_OBJS} ${PROG} ${PROG_NOINST} ${SHARED_LIB} ${SHARED_LIB_NOINST} ${AMIGA_LIB} ${AMIGA_LIB_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${FRAMEWORK} ${PLUGIN} ${PLUGIN_NOINST} ${CLEAN_LIB} ${MO_FILES} ${CLEAN}; do \
		test x"$$i" = x"" && continue; \
		if test -f $$i -o -d $$i; then \
			if rm -fr $$i; then \
				${DELETE_OK}; \
			else \
				${DELETE_FAILED}; \
			fi \
951
952
953
954
955
956
957
958
959
960



961
962
963
964
965
966
967
949
950
951
952
953
954
955



956
957
958
959
960
961
962
963
964
965







-
-
-
+
+
+







	done

print-var:
	printf '%s\n' '${${VAR}}'

DIR_ENTER = printf "@TERM_EL@@TERM_SETAF6@Entering directory @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF6@.@TERM_SGR0@\n" "$$i"; cd $$i || exit $$?
DIR_LEAVE = printf "@TERM_EL@@TERM_SETAF6@Leaving directory @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF6@.@TERM_SGR0@\n" "$$i"; cd .. || exit $$?
DEPEND_STATUS = printf "@TERM_EL@@TERM_SETAF3@Generating dependencies...@TERM_SGR0@\r"
DEPEND_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully generated dependencies.@TERM_SGR0@\n"
DEPEND_FAILED = err=$$?; printf "@TERM_EL@@TERM_SETAF1@Failed to generate dependencies!@TERM_SGR0@\n"; exit $$err
DEPEND_STATUS = printf "@TERM_EL@@TERM_SETAF3@Generating dependencies for @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF3@...@TERM_SGR0@\r" "$<"
DEPEND_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully generated dependencies for @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF2@.@TERM_SGR0@\n" "$<"
DEPEND_FAILED = err=$$?; printf "@TERM_EL@@TERM_SETAF1@Failed to generate dependencies for @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF1@!@TERM_SGR0@\n" "$<"; exit $$err
COMPILE_STATUS = printf "@TERM_EL@@TERM_SETAF3@Compiling @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF3@...@TERM_SGR0@\r" "$<"
COMPILE_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully compiled @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF2@.@TERM_SGR0@\n" "$<"
COMPILE_FAILED = err=$$?; printf "@TERM_EL@@TERM_SETAF1@Failed to compile @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF1@!@TERM_SGR0@\n" "$<"; exit $$err
COMPILE_LIB_STATUS = printf "@TERM_EL@@TERM_SETAF3@Compiling @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF3@ (lib)...@TERM_SGR0@\r" "$<"
COMPILE_LIB_OK = printf "@TERM_EL@@TERM_SETAF2@Successfully compiled @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF2@ (lib).@TERM_SGR0@\n" "$<"
COMPILE_LIB_FAILED = err=$$?; printf "@TERM_EL@@TERM_SETAF1@Failed to compile @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF1@ (lib)!@TERM_SGR0@\n" "$<"; exit $$err
COMPILE_AMIGA_LIB_STATUS = printf "@TERM_EL@@TERM_SETAF3@Compiling @TERM_BOLD@%s@TERM_SGR0@@TERM_SETAF3@ (Amiga lib)...@TERM_SGR0@\r" "$<"