Skip to content

Commit

Permalink
Makefile: Add generic sed rules to generate scripts and manpages
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Aug 11, 2015
1 parent 1f33b20 commit 0385193
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,22 @@ quiet-install = $(call quiet-command,install -m ${1} ${2} ${3},"INSTALL ${3} [mo
quiet-installdir = $(call quiet-command,install -m ${1} -d ${2}," MKDIR ${2} [mode=${1}]")
quiet-installforuser = $(call quiet-command,install -m ${1} -o ${2} -g ${3} ${4} ${5},"INSTALL ${5} (user=${2} group=${3}) [mode=${1}]")

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

sed-rules = -e 's,@PREFIX@,${PREFIX},g' \
-e 's,@EPREFIX@,${EPREFIX},g' \
-e 's,@BINDIR@,${BINDIR},g' \
-e 's,@SBINDIR@,${SBINDIR},g' \
-e 's,@LIBDIR@,${LIBDIR},g' \
-e 's,@SYSCONFDIR@,${SYSCONFDIR},g' \
-e 's,@DEFCONFDIR@,${DEFCONFDIR},g' \
-e 's,@LIBEXECDIR@,${LIBEXECDIR},g' \
-e 's,@BEE_VERSION@,${BEE_VERSION},g' \
-e 's,@DATADIR@,${DATADIR},g' \
-e 's,@MXQ_VERSION@,${MXQ_VERSION},g' \
-e 's,@MXQ_MYSQL_DEFAULT_FILE@,${MXQ_MYSQL_DEFAULT_FILE},g' \


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

%.o: %.c Makefile
Expand All @@ -113,6 +129,9 @@ quiet-installforuser = $(call quiet-command,install -m ${1} -o ${2} -g ${3} ${4}
%: %.o
$(call quiet-command,${CC} -o $@ $^ $(LDFLAGS) $(LDLIBS), " LINK $@")

%: %.in Makefile
$(call quiet-command,sed ${sed-rules} $< >$@, " GEN $@")

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

.SECONDARY:
Expand All @@ -123,7 +142,7 @@ manpages/%: manpages/%.xml
$(call quiet-command,xmlto --stringparam man.output.quietly=1 man $^ -o manpages, " XMLTO $@")

%: manpages/% Makefile
$(call quiet-command,sed -e "s/@MXQ_VERSION@/${MXQ_VERSION}/" $< >$@, " GEN $@")
$(call quiet-command,sed ${sed-rules} $< >$@, " GEN $@")

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

Expand Down

0 comments on commit 0385193

Please sign in to comment.