From ad0b7a7d38d77f0cb90e1509e2eb56a6cbb8db75 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 1 Jun 2021 10:47:29 -0700 Subject: build: improved mechanism for copying .shipped files. * Makefile (SHIPPED): New variable, holds names of files that get copied to a .shipped suffix and commited to the repo. (ABBREV3SH): New macro, version of ABBREV3 that doesn't assume it is expanding an entire recipe line, and thus can be embedded into shell commands. (%.shipped): Rule removed. (shipped): New rule that prints what it is copying. Non-maintainer version of rule errors out. --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index bca943a8..e9c122f6 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,8 @@ SRCS := $(addprefix $(top_srcdir),\ ls-files "*.c" "*.h" "*.l" "*.y"))) endif +SHIPPED := lex.yy.c y.tab.c y.tab.h + # MPI objects MPI_OBJ_BASE=mpi.o @@ -110,6 +112,7 @@ ABBREVN = $(if $(VERBOSE),\ @printf "%s %s -> %s\n" $(1) \ "$(patsubst $(top_srcdir)%,%,$(filter-out $(DEP_$@),$^))" $@) ABBREV3 = $(if $(VERBOSE),@:,@printf "%s %s -> %s\n" $(1) "$(3)" $(2)) +ABBREV3SH = $(if $(VERBOSE),:,printf "%s %s -> %s\n" $(1) "$(3)" $(2)) define DEPGEN $(V)sed -e ':x' \ @@ -289,9 +292,12 @@ lex.yy.c: $(top_srcdir)parser.l false ; \ fi) -%.shipped: $(top_srcdir)% - $(call ABBREV,COPY) - $(call SH,[ $^ -nt $@ ] && cp $^ $@) +shipped: + $(V)$(foreach NAME,$(SHIPPED), \ + if ! cmp -s $(NAME) $(NAME).shipped; then \ + $(call ABBREV3SH,COPY,$(NAME),$(NAME).shipped); \ + cp $(NAME) $(NAME).shipped; \ + fi;) else -- cgit v1.2.3