]> git.draconx.ca Git - rrace.git/blobdiff - Makefile.am
Combine motifgui.dat / motifstr.str into one file.
[rrace.git] / Makefile.am
index 821701d39acc2b501b0dbaeee1a6382694f1a2db..e5efa40c5410206321cd92a62f10e0050ea26165 100644 (file)
@@ -55,7 +55,7 @@ $(libmotifmain_a_OBJECTS): src/motifopt.h
 EXTRA_LIBRARIES += libmotifui.a
 libmotifui_a_SOURCES = src/motif_ui.c
 $(libmotifui_a_OBJECTS): $(gnulib_headers)
-$(libmotifui_a_OBJECTS): src/motifgui.h src/motifstr.h
+$(libmotifui_a_OBJECTS): src/motifgui.h
 
 EXTRA_LIBRARIES += libglohelp.a
 libglohelp_a_SOURCES = common/src/help.c common/src/help.h
@@ -71,21 +71,22 @@ $(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
 DISTCLEANFILES += $(OPTFILES:.opt=.h)
 EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
 
-STRFILES = src/motifstr.str
-.str.h:
-       $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-strtab.awk $< >$@.tmp
-       $(AM_V_at) mv -f $@.tmp $@
-$(STRFILES:.str=.h): $(DX_BASEDIR)/scripts/gen-strtab.awk
-DISTCLEANFILES += $(STRFILES:.str=.h)
-EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-strtab.awk $(STRFILES)
-
-GUIFILES = src/motifgui.dat
+TREEFILES = src/motifgui.dat
 .dat.h:
-       $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-tree.awk $< >$@.tmp
-       $(AM_V_at) mv -f $@.tmp $@
-$(GUIFILES:.dat=.h): $(DX_BASEDIR)/scripts/gen-tree.awk
-DISTCLEANFILES += $(GUIFILES:.dat=.h)
-EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-tree.awk $(GUIFILES)
+       $(AM_V_GEN) :; { \
+         $(AWK) -f $(DX_BASEDIR)/scripts/gen-tree.awk $< && \
+         printf '%s\n' \
+           'sub(/^#&/, "\\&") == 0 { next }' \
+           '{ has_strtab=1 } END { if (!has_strtab) { exit(0); } print "" }' \
+           | $(AWK) -f - -f $(DX_BASEDIR)/scripts/gen-strtab.awk $<; \
+       } >$@-t
+       $(AM_V_at) mv -f $@-t $@
+$(TREEFILES:.dat=.h): $(DX_BASEDIR)/scripts/gen-strtab.awk
+EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-strtab.awk
+$(TREEFILES:.dat=.h): $(DX_BASEDIR)/scripts/gen-tree.awk
+EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-tree.awk
+DISTCLEANFILES += $(TREEFILES:.dat=.h)
+EXTRA_DIST += $(TREEFILES)
 
 check_PROGRAMS = t/boardmove t/boardbit t/ewmhicon t/rng-test
 EXTRA_DIST += t/xos256ss.c