Project

General

Profile

« Previous | Next » 

Revision 8767

bugfix: lib/common.Makefile: Compression: %.gz <-> %: only run command if target does not exist, to avoid overwriting the target when the compressed or uncompressed version is newer than it. the difference in mtimes can arise when one file is created after the other, and should not cause the opposite operation to be performed to try to make the other file up-to-date (leading to an infinite back-and-forth of creating one file from the other).

View differences:

common.Makefile
118 118

  
119 119
##### Compression
120 120

  
121
define gunzip
122
gunzip <$< >$@
123
touch -r $@ $<
124
endef
125

  
121 126
%:: %.gz
122
	gunzip <$< >$@
123
	touch -r $@ $<
127
	$(if $(wildcard $@),,$(gunzip))
124 128

  
129
define gzip
130
gzip <$< >$@
131
touch -r $@ $<
132
endef
133

  
125 134
ifneq ($(filter %.gz,$(MAKECMDGOALS)),)
126 135
%.gz: %
127
	gzip <$< >$@
128
	touch -r $@ $<
136
	$(if $(wildcard $@),,$(gzip))
129 137
endif

Also available in: Unified diff