Skip to content

Commit f609594

Browse files
committed
build-sys,refactor: arrange check-genfile target more make-oriented
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 3a62ddb commit f609594

File tree

1 file changed

+66
-3
lines changed

1 file changed

+66
-3
lines changed

makefiles/testing.mak

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,42 +309,91 @@ clean-man-test:
309309
chkgen_verbose = $(chkgen_verbose_@AM_V@)
310310
chkgen_verbose_ = $(chkgen_verbose_@AM_DEFAULT_V@)
311311
chkgen_verbose_0 = @echo CHKGEN " $@";
312-
check-genfile:
313-
if BUILD_IN_GIT_REPO
312+
313+
recover_side_effects = cg-force-optlib2c-srcs cg-force-txt2cstr-srcs cg-force-man-docs
314+
314315
# OPTLIB2C_SRCS : committed for win32 build
316+
.PHONY: cg-clean-optlib2c-srcs cg-force-optlib2c-srcs check-genfile-optlib2c-srcs
317+
cg-clean-optlib2c-srcs:
318+
if BUILD_IN_GIT_REPO
315319
$(chkgen_verbose)rm -f $(OPTLIB2C_SRCS)
320+
endif
321+
cg-force-optlib2c-srcs: cg-clean-optlib2c-srcs
322+
if BUILD_IN_GIT_REPO
316323
$(chkgen_verbose)$(MAKE) $(OPTLIB2C_SRCS)
324+
endif
325+
check-genfile-optlib2c-srcs: $(recover_side_effects) cg-force-optlib2c-srcs
326+
if BUILD_IN_GIT_REPO
317327
$(chkgen_verbose)if ! git diff --exit-code $(OPTLIB2C_DIR); then \
318328
echo "Files under $(OPTLIB2C_DIR) are not up to date." ; \
319329
echo "If you change $(OPTLIB2C_DIR)/foo.ctags, don't forget to add $(OPTLIB2C_DIR)/foo.c to your commit." ; \
320330
exit 1 ; \
321331
else \
322332
echo "Files under $(OPTLIB2C_DIR) are up to date." ; \
323333
fi
334+
endif
335+
324336
# TXT2CSTR_SRCS : committed for win32 build
337+
.PHONY: cg-clean-txt2cstr-srcs cg-force-txt2cstr-srcs check-genfile-txt2cstr-srcs
338+
cg-clean-txt2cstr-srcs:
339+
if BUILD_IN_GIT_REPO
325340
$(chkgen_verbose)rm -f $(TXT2CSTR_SRCS)
341+
endif
342+
cg-force-txt2cstr-srcs: cg-clean-txt2cstr-srcs
343+
if BUILD_IN_GIT_REPO
326344
$(chkgen_verbose)$(MAKE) $(TXT2CSTR_SRCS)
345+
endif
346+
check-genfile-txt2cstr-srcs: $(recover_side_effects) cg-force-txt2cstr-srcs
347+
if BUILD_IN_GIT_REPO
327348
$(chkgen_verbose)if ! git diff --exit-code $(TXT2CSTR_DIR); then \
328349
echo "Files under $(TXT2CSTR_DIR) are not up to date." ; \
329350
echo "If you change $(TXT2CSTR_DIR)/foo.ps, don't forget to add $(TXT2CSTR_DIR)/foo.c to your commit." ; \
330351
exit 1 ; \
331352
else \
332353
echo "Files under $(TXT2CSTR_DIR) are up to date." ; \
333354
fi
334-
if HAVE_RST2MAN
355+
endif
356+
335357
# man/*.in : committed for man pages to be genrated without rst2man
336358
# make clean-docs remove both man/*.in and docs/man/*.rst
359+
.PHONY: cg-clean-man-docs cg-force-man-docs check-genfile-man-docs
360+
cg-clean-man-docs:
361+
if BUILD_IN_GIT_REPO
362+
if HAVE_RST2MAN
337363
$(chkgen_verbose)$(MAKE) -C man clean-docs
364+
endif
365+
endif
366+
cg-force-man-docs: cg-clean-man-docs
367+
if BUILD_IN_GIT_REPO
368+
if HAVE_RST2MAN
338369
$(chkgen_verbose)$(MAKE) -C man man-in
370+
endif
371+
endif
372+
check-genfile-man-docs: $(recover_side_effects) cg-force-man-docs
373+
if BUILD_IN_GIT_REPO
374+
if HAVE_RST2MAN
339375
$(chkgen_verbose)if ! git diff --exit-code -- man; then \
340376
echo "Files under man/ are not up to date." ; \
341377
echo "Please execute 'make -C man man-in' and commit them." ; \
342378
exit 1 ; \
343379
else \
344380
echo "Files under man are up to date." ; \
345381
fi
382+
endif
383+
endif
384+
346385
# docs/man/*.rst : committed for Read the Docs
386+
.PHONY: cg-force-update-docs check-genfile-update-docs
387+
cg-force-update-docs: check-genfile-man-docs
388+
if BUILD_IN_GIT_REPO
389+
if HAVE_RST2MAN
347390
$(chkgen_verbose)$(MAKE) -C man update-docs
391+
endif
392+
endif
393+
394+
check-genfile-update-docs: cg-force-update-docs $(recover_side_effects)
395+
if BUILD_IN_GIT_REPO
396+
if HAVE_RST2MAN
348397
$(chkgen_verbose)if ! git diff --exit-code -- docs/man; then \
349398
echo "Files under docs/man/ are not up to date." ; \
350399
echo "Please execute 'make -C man update-docs' and commit them." ; \
@@ -353,12 +402,20 @@ if HAVE_RST2MAN
353402
echo "Files under docs/man are up to date." ; \
354403
fi
355404
endif
405+
endif
406+
356407
# win32/ctags_vs2013.vcxproj* : committed for win32 build without POSIX tools
357408
# regenerate files w/o out-of-source build and w/ GNU make
409+
.PHONY: cg-force-win32 check-genfile-win32
410+
cg-force-win32:
411+
if BUILD_IN_GIT_REPO
358412
$(chkgen_verbose)if test "$(top_srcdir)" = "$(top_builddir)" \
359413
&& ($(MAKE) --version) 2>/dev/null | grep -q GNU ; then \
360414
$(MAKE) -BC win32 ; \
361415
fi
416+
endif
417+
check-genfile-win32: cg-force-win32 $(recover_side_effects)
418+
if BUILD_IN_GIT_REPO
362419
$(chkgen_verbose)if ! git diff --exit-code -- win32; then \
363420
if test "$(SKIP_CHECKGEN_WIN32)" = "yes"; then \
364421
echo "Skip checking the files under win32." ; \
@@ -373,6 +430,12 @@ endif
373430
fi
374431
endif
375432

433+
check-genfile: \
434+
check-genfile-optlib2c-srcs \
435+
check-genfile-txt2cstr-srcs \
436+
check-genfile-update-docs \
437+
check-genfile-win32
438+
376439
#
377440
# Test installation
378441
#

0 commit comments

Comments
 (0)