On Thu, Jun 30, 2011 at 10:58 AM, Mike Frysinger <[email protected]> wrote:
> On Thu, Jun 30, 2011 at 09:51, Jie Zhang wrote:
>> * src/cmd/Makefile.am (generated_cmd_list.h): Always update the file to
>> avoid constant generation loops where other files are newer, but not
>> a different list of commands.
>>
>> With r1927, changing to single cmd_xxx.c file, even it does not change
>> the cmd list, all cmd files will be rebuilt.
>
> yes, i noticed ... it's a bit obnoxious.
>
>> Why your original code does not work?
>
> the changelog says why ... if you do `touch cmd_bfin.c`, then the
> cmd_list.h will always get generated on every `make`.
>
> i guess an alternative would be that if the list is unchanged, then do
> `touch -r cmd_list.h generated_cmd_list.h`. i didnt do that
> originally as i wanted to avoid portability issues, but i guess this
> syntax is in POSIX, so it should be fine.
>
This will not work for all cases. For example, when cmd_list.h is
older than some cmd C file, generated_cmd_list.h will be generated
again and again.
I propose the attached patch. It should solve this issue. But it has a
minor issue. Touch cmd_bfin.c and make
make[3]: Entering directory `/home/jie/sources/urjtag/git/urjtag/src/cmd'
GEN generated_cmd_list.h.stamp
generated_cmd_list.h is unchanged
CC cmd_bfin.lo
CCLD libcmd.la
make[3]: Leaving directory `/home/jie/sources/urjtag/git/urjtag/src/cmd'
It's not ideally "GEN generated_cmd_list.h". I hope it's more
acceptable than the issues without this patch.
Regards,
Jie
diff --git a/urjtag/src/cmd/Makefile.am b/urjtag/src/cmd/Makefile.am
index f6432eb..c480273 100644
--- a/urjtag/src/cmd/Makefile.am
+++ b/urjtag/src/cmd/Makefile.am
@@ -80,14 +80,24 @@ libcmd_la_SOURCES = \
$(all_cmd_files)
$(libcmd_la_OBJECTS): generated_cmd_list.h
-generated_cmd_list.h: $(all_cmd_files)
+generated_cmd_list.h: generated_cmd_list.h.stamp ; @true
+generated_cmd_list.h.stamp: $(all_cmd_files)
$(AM_V_GEN)set -e; \
cmds=`$(SED) -n '/^const urj_cmd_t urj_cmd_/{s:.*urj_cmd_::;s: =.*::;p}' $^`; \
for c in $$cmds ; do \
printf '#ifndef URJ_CMD_SKIP_%s\n_URJ_CMD(%s)\n#endif\n' $$c $$c; \
- done > $@
+ done > generated_cmd_list.h.tmp; \
+ if cmp -s generated_cmd_list.h generated_cmd_list.h.tmp; then \
+ echo generated_cmd_list.h is unchanged; \
+ rm -f generated_cmd_list.h.tmp; \
+ else \
+ echo updating generated_cmd_list.h; \
+ mv generated_cmd_list.h.tmp generated_cmd_list.h; \
+ fi; \
+ touch $@
-EXTRA_DIST = generated_cmd_list.h
-MAINTAINERCLEANFILES = generated_cmd_list.h
+
+EXTRA_DIST = generated_cmd_list.h generated_cmd_list.h.stamp
+MAINTAINERCLEANFILES = generated_cmd_list.h generated_cmd_list.h.stamp
AM_CFLAGS = $(WARNINGCFLAGS)
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development