test support of group having multiple .cpp files
[libt2n] / example-codegen / Makefile.am
... / ...
CommitLineData
1INCLUDES = -I$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I$(top_srcdir)/codegen
2
3LDADD = $(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@
4
5CMDGROUPS = default other
6
7default_GROUP = default.cpp
8other_GROUP = other-1.cpp other-2.cpp
9
10# unfortunately we can't set those from variables
11# because they are parsed by automake
12
13libdefault_la_SOURCES = default_client.cpp
14libother_la_SOURCES = other_client.cpp
15noinst_LTLIBRARIES = libdefault.la libother.la
16
17client_SOURCES = client.cpp
18client_LDADD = $(LDADD) libdefault.la libother.la
19
20server_SOURCES = server.cpp \
21 $(other_GROUP) other_server.cpp \
22 $(default_GROUP) default_server.cpp \
23 foo.hxx
24
25noinst_PROGRAMS = client server
26
27
28# always the same:
29
30IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j)))
31STAMPS=$(CMDGROUPS:=.stamp)
32$(STAMPS): %.stamp : $(IFILES) $(top_builddir)/codegen/codegen Makefile.am
33# assuming we have some unix like shell (maybe even bash)
34 echo IFILES: $(IFILES)
35 echo BUILT_SOURCES: $(BUILT_SOURCES)
36 cp -v $(top_srcdir)/codegen/codegen-stubhead.hxx $*_common.hxx;
37 cp -v $(top_srcdir)/codegen/codegen-stubhead.hxx $*_server.hxx;
38# todo use tmp file for xml file
39 for i in $($*_GROUP); do \
40 gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $${i} -fxml=$${i%*.cpp}.xml; \
41 done; \
42 $(top_builddir)/codegen/codegen $*.cpp $* $($*_GROUP:.cpp=.xml) && touch $@
43
44# assuming we have gnu make?
45BUILT_SOURCES = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) )
46
47$(BUILT_SOURCES) : $(STAMPS)
48
49TESTS = test
50
51CLEANFILES = $(BUILT_SOURCES) $(STAMPS)
52
53# TODO:
54# howto generate Makefile(.in) from something like this:
55
56# CMDGROUPS = default other
57
58# default_SOURCES = default-1.cpp default-2.cpp
59# other_SOURCES = other.cpp
60
61# TESTS = test
62
63# server_SOURCES = server.cpp default foo.hxx