[Pkg-bitcoin-commits] [libunivalue] 52/76: build: Add a 'make gen' target that should work anywhere

Jonas Smedegaard dr at jones.dk
Mon Apr 4 09:18:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libunivalue.

commit 9e0748ec0304c2cfd3111ec31c1ca622c52be78d
Author: Cory Fields <cory-nospam- at coryfields.com>
Date:   Fri Sep 25 16:13:31 2015 -0400

    build: Add a 'make gen' target that should work anywhere
    
    Rather than always building the object regardless of the build sytem, add
    a manual target instead. 'make gen' will build using the system's compiler
    rather than the target one.
---
 Makefile.am          | 17 ++++++++++++++---
 configure.ac         |  8 ++++++++
 {lib => gen}/gen.cpp |  0
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d945060..7f501d7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,6 @@
 ACLOCAL_AMFLAGS = -I build-aux/m4
+.PHONY: gen
+.INTERMEDIATE: $(GENBIN)
 
 include_HEADERS = include/univalue.h
 noinst_HEADERS = lib/univalue_escapes.h
@@ -17,9 +19,18 @@ lib_libunivalue_la_CXXFLAGS = -I$(top_srcdir)/include
 
 TESTS = test/unitester
 
-noinst_PROGRAMS = lib/gen $(TESTS)
+GENBIN = gen/gen$(BUILD_EXEEXT)
+GEN_SRCS = gen/gen.cpp
 
-lib_gen_SOURCES = lib/gen.cpp
+$(GENBIN): $(GEN_SRCS)
+	@echo Building $@
+	$(AM_V_at)c++ -I$(top_srcdir)/include -o $@ $<
+
+gen: lib/univalue_escapes.h $(GENBIN)
+	@echo Updating $<
+	$(AM_V_at)$(GENBIN) > lib/univalue_escapes.h
+
+noinst_PROGRAMS = $(TESTS)
 
 TEST_DATA_DIR=test
 
@@ -67,4 +78,4 @@ TEST_FILES = \
 	$(TEST_DATA_DIR)/pass2.json \
 	$(TEST_DATA_DIR)/pass3.json
 
-EXTRA_DIST=$(TEST_FILES)
+EXTRA_DIST=$(TEST_FILES) $(GEN_SRCS)
diff --git a/configure.ac b/configure.ac
index 802035b..8f3fa31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,11 +51,19 @@ case $host in
   ;;
 esac
 
+BUILD_EXEEXT=
+case $build in
+  *mingw*)
+    BUILD_EXEEXT=".exe"
+  ;;
+esac
+
 AC_CONFIG_FILES([
     Makefile
     lib/libunivalue.pc
     lib/libunivalue-uninstalled.pc])
 
 AC_SUBST(LIBTOOL_APP_LDFLAGS)
+AC_SUBST(BUILD_EXEEXT)
 AC_OUTPUT
 
diff --git a/lib/gen.cpp b/gen/gen.cpp
similarity index 100%
rename from lib/gen.cpp
rename to gen/gen.cpp

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/libunivalue.git



More information about the Pkg-bitcoin-commits mailing list