summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-01 10:47:29 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-01 10:47:29 -0700
commitad0b7a7d38d77f0cb90e1509e2eb56a6cbb8db75 (patch)
treec50f492d49243200e0a9b87f7808582f3d4f1e59 /Makefile
parent7b6dae900bb4a2cb260362bad29728050c201164 (diff)
downloadtxr-ad0b7a7d38d77f0cb90e1509e2eb56a6cbb8db75.tar.gz
txr-ad0b7a7d38d77f0cb90e1509e2eb56a6cbb8db75.tar.bz2
txr-ad0b7a7d38d77f0cb90e1509e2eb56a6cbb8db75.zip
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.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 9 insertions, 3 deletions
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