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