dogecoin/src/Makefile.include
Cory Fields 152e51c7af included-tests: generate binary data from test files for inclusion into test binaries
This change moves test data into the binaries rather than reading them from
the disk at runtime.

Advantages:
- Tests become distributable
- Cross-compile friendly. Build on one machine and execute in an arbitrary
  location on another.
- Easier testing for backports. Users can verify that tests pass without having
  to track down corresponding test data.
- More trustworthy test results and easier quality assurance as tests make
  fewer assumptions about their environment.
- Tests could theoretically run at client/daemon startup and exit on failure.

Disadvantages:
- Required 'hexdump' build-dependency. This is a standard bsd tool that should
  be usable everywhere. It is likely already installed on all build-machines.
- Tests can no longer be fudged after build by altering test-data.
2013-09-16 12:53:11 -04:00

68 lines
2.2 KiB
Makefile

.PHONY: FORCE
LIBBITCOIN=$(top_builddir)/src/libbitcoin.a
LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a
LIBMEMENV=$(top_builddir)/src/leveldb/libmemenv.a
LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a
INCLUDES += $(BDB_CPPFLAGS)
LIBBITCOIN += $(BDB_LIBS)
$(LIBBITCOIN):
$(MAKE) -C $(top_builddir)/src $(@F)
$(LIBLEVELDB) $(LIBMEMENV):
$(MAKE) -C $(top_builddir)/src leveldb/$(@F)
$(LIBBITCOINQT):
$(MAKE) -C $(top_builddir)/src/qt $(@F)
.mm.o:
$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(CXXFLAGS) -c -o $@ $<
.rc.o:
@test -f $(WINDRES) && $(WINDRES) -i $< -o $@ || \
echo error: could not build $@
ui_%.h: %.ui
@test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D)
@test -f $(UIC) && $(UIC) -o $(abs_builddir)/$@ $(abs_srcdir)/$< || echo error: could not build $(abs_builddir)/$@
$(SED) -i.bak -e '/^\*\*.*Created:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak
$(SED) -i.bak -e '/^\*\*.*by:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak
%.moc: %.cpp
$(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $<
$(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak
$(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak
moc_%.cpp: %.h
$(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $<
$(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak
$(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak
%.qm: %.ts
@test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D)
@test -f $(LRELEASE) && $(LRELEASE) $(abs_srcdir)/$< -qm $(abs_builddir)/$@ || \
echo error: could not build $(abs_builddir)/$@
%.pb.cc %.pb.h: %.proto
test -f $(PROTOC) && $(PROTOC) --cpp_out=$(@D) --proto_path=$(abspath $(<D) $<) || \
echo error: could not build $@
%.json.h: %.json
@$(MKDIR_P) $(@D)
@echo "namespace json_tests{" > $@
@echo "static unsigned const char $(*F)[] = {" >> $@
@$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' >> $@
@echo "};};" >> $@
@echo "Generated $@"
%.raw.h: %.raw
@$(MKDIR_P) $(@D)
@echo "namespace alert_tests{" > $@
@echo "static unsigned const char $(*F)[] = {" >> $@
@$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' >> $@
@echo "};};" >> $@
@echo "Generated $@"