improved makefile
[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
30#IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j)))
31STAMPS=$(CMDGROUPS:=.stamp)
32
33GROUPDEP_FILES = $(foreach i, $(CMDGROUPS), .deps/group_$(i).P)
34-include $(GROUPDEP_FILES)
35
36.deps/group_%.P : Makefile.am
37 echo $@ : $($*_GROUP) > .deps/group_$*.P
38
39%.stamp : .deps/group_%.P $(top_builddir)/codegen/codegen Makefile.am
40# assuming we have some unix like shell (maybe even bash)
41 echo BUILT_SOURCES: $(BUILT_SOURCES)
42 cp -v $(top_srcdir)/codegen/codegen-stubhead.hxx $*_common.hxx;
43 cp -v $(top_srcdir)/codegen/codegen-stubhead.hxx $*_server.hxx;
44# todo use tmp file for xml file
45 for i in $($*_GROUP); do \
46 gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $${i} -fxml=$${i%*.cpp}.xml; \
47 done; \
48 $(top_builddir)/codegen/codegen $*.cpp $* $($*_GROUP:.cpp=.xml) && touch $@
49
50# assuming we have gnu make?
51BUILT_SOURCES = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) )
52
53$(BUILT_SOURCES) : $(STAMPS)
54
55TESTS = test
56
57CLEANFILES = $(BUILT_SOURCES) $(STAMPS)
58
59# TODO:
60# howto generate Makefile(.in) from something like this:
61
62# CMDGROUPS = default other
63
64# default_SOURCES = default-1.cpp default-2.cpp
65# other_SOURCES = other.cpp
66
67# TESTS = test
68
69# server_SOURCES = server.cpp default foo.hxx