Skip to content

Commit

Permalink
use a generic m4 define script for everything
Browse files Browse the repository at this point in the history
  • Loading branch information
stettberger committed Oct 25, 2009
1 parent b8493f1 commit e9c8928
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Makefile
Expand Up @@ -134,10 +134,10 @@ $(ECMD_PARSER_SUPPORT)_META_SRC += protocols/ecmd/ecmd_defs.m4 ${named_pin_simpl
y_META_SRC += $(y_NP_SIMPLE_META_SRC)

meta.c: $(y_META_SRC)
@m4 $^ > $@
@m4 `scripts/m4-defines` $^ > $@

meta.h: scripts/meta_header_magic.m4 meta.m4
@m4 $^ > $@
@m4 `scripts/m4-defines` $^ > $@

##############################################################################

Expand Down Expand Up @@ -196,10 +196,8 @@ embed/%: embed/%.cpp


embed/%: embed/%.m4
@if ! m4 `grep -e "^#define .*_SUPPORT" autoconf.h | \
sed -e "s/^#define /-Dconf_/" -e "s/_SUPPORT.*//"` \
`grep -e "^#define CONF_.*" autoconf.h | sed -e "s/^#define CONF_/-Dvalue_/" -re "s/( )/=/" -e "s/[ \"]//g"` \
$< > $@; then $(RM) $@; echo "--> Don't include $@ ($<)";\
@if ! m4 `scripts/m4-defines` $< > $@; \
then $(RM) $@; echo "--> Don't include $@ ($<)";\
else echo "--> Include $@ ($<)"; fi

embed/%: embed/%.sh
Expand Down Expand Up @@ -283,8 +281,7 @@ PINNING_FILES=pinning/internals/header.m4 \
$(wildcard pinning/internals/hackery_$(MCU).m4) \
$(wildcard pinning/hardware/$(HARDWARE).m4) pinning/internals/footer.m4
pinning.c: $(PINNING_FILES) autoconf.h
@m4 -I$(TOPDIR)/pinning `grep -e "^#define .*_SUPPORT" autoconf.h | \
sed -e "s/^#define /-Dconf_/" -e "s/_SUPPORT.*//"` $(PINNING_FILES) > $@
@m4 -I$(TOPDIR)/pinning `scripts/m4-defines` $(PINNING_FILES) > $@


##############################################################################
Expand Down
4 changes: 4 additions & 0 deletions scripts/m4-defines
@@ -0,0 +1,4 @@
#!/bin/sh

grep -e "^#define .*_SUPPORT" autoconf.h | sed -e "s/^#define /-Dconf_/" -e "s/_SUPPORT.*//"
grep -e "^#define CONF_.*" autoconf.h | sed -e "s/^#define CONF_/-Dvalue_/" -re "s/( )/=/" -e "s/[ \"]//g"

0 comments on commit e9c8928

Please sign in to comment.