Commit | Line | Data |
---|---|---|
86c1c2e9 | 1 | INCLUDES = -I$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I$(top_srcdir)/codegen |
86c1c2e9 JT |
2 | LDADD = $(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@ |
3 | ||
6e27f586 | 4 | # list your command groups |
1f5e9bde JT |
5 | CMDGROUPS = default other |
6 | ||
6e27f586 | 7 | # for each command group list the files to parse for LIBT2N_EXPORT |
c5e54ff2 | 8 | default_GROUP = default.cpp |
6e27f586 | 9 | # example of a command group using multiple cpp files |
c5e54ff2 JT |
10 | other_GROUP = other-1.cpp other-2.cpp |
11 | ||
1e683bb5 JT |
12 | # headers declaring data types used as rpc arguments must be listed manually |
13 | # (in this example the class Foo) | |
3c4dd222 JT |
14 | include_HEADERS = foo.hxx |
15 | ||
0cfa3fb2 JT |
16 | # unfortunately we can't set those from variables |
17 | # because they are parsed by automake | |
18 | ||
a96ab628 JT |
19 | libdefault_la_SOURCES = default_client.cpp |
20 | libother_la_SOURCES = other_client.cpp | |
3c4dd222 JT |
21 | lib_LTLIBRARIES = libdefault.la libother.la |
22 | ||
3c4dd222 | 23 | # build an example server and client |
86c1c2e9 | 24 | client_SOURCES = client.cpp |
a96ab628 | 25 | client_LDADD = $(LDADD) libdefault.la libother.la |
6e27f586 | 26 | |
d8694b16 | 27 | server_SOURCES = server.cpp \ |
c5e54ff2 | 28 | $(other_GROUP) other_server.cpp \ |
1e683bb5 | 29 | $(default_GROUP) default_server.cpp |
6e27f586 | 30 | |
86c1c2e9 JT |
31 | noinst_PROGRAMS = client server |
32 | ||
3c4dd222 JT |
33 | # test script |
34 | ||
35 | TESTS = test | |
1f5e9bde | 36 | |
c0a5c771 | 37 | EXTRA_DIST = $(TESTS) |
1e683bb5 | 38 | |
1f5e9bde JT |
39 | # always the same: |
40 | ||
3c4dd222 JT |
41 | include_HEADERS += $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx) |
42 | ||
4c298f07 | 43 | #IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j))) |
4c298f07 | 44 | |
c0a5c771 | 45 | -include $(foreach i, $(CMDGROUPS), group_$(i).P) |
4c298f07 | 46 | |
c0a5c771 JT |
47 | group_%.P : Makefile.am |
48 | echo $@ : $($*_GROUP) > group_$*.P | |
4c298f07 | 49 | |
c0a5c771 | 50 | %.stamp : group_%.P $(top_builddir)/codegen/codegen |
c5e54ff2 | 51 | # assuming we have some unix like shell (maybe even bash) |
1f5e9bde | 52 | echo BUILT_SOURCES: $(BUILT_SOURCES) |
b6ead8d8 | 53 | # temporarily create _common.hxx file (will be overwritten by codegen below) |
7309b9a1 JT |
54 | echo '#include "codegen-stubhead.hxx"' > $*_common.hxx; |
55 | echo '#include "$*.hxx"' >> $*_common.hxx; | |
a96ab628 | 56 | # todo use tmp file for xml file |
c5e54ff2 | 57 | for i in $($*_GROUP); do \ |
c0a5c771 | 58 | gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/$${i} -fxml=$${i%*.cpp}.xml; \ |
c5e54ff2 | 59 | done; \ |
85106017 | 60 | $(top_builddir)/codegen/codegen $* $($*_GROUP:.cpp=.xml) && touch $@ |
a96ab628 | 61 | |
1f5e9bde JT |
62 | # assuming we have gnu make? |
63 | BUILT_SOURCES = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) ) | |
71ae912c | 64 | |
3c4dd222 | 65 | STAMPS=$(CMDGROUPS:=.stamp) |
c5e54ff2 | 66 | $(BUILT_SOURCES) : $(STAMPS) |
acf4b39c | 67 | |
3c4dd222 JT |
68 | # Install the pkg-config files: |
69 | pkgconfigdir = $(libdir)/pkgconfig | |
70 | pkgconfig_DATA = $(CMDGROUPS:=.pc) | |
71 | ||
72 | # .pc files (one pc file for each command group) | |
73 | %.pc : $(top_srcdir)/codegen/clientlib.pc.in Makefile | |
74 | sed \ | |
75 | -e 's,@CMDGROUP@,$*,g' \ | |
76 | -e 's,\@prefix\@,$(prefix),g' \ | |
77 | -e 's,\@exec_prefix\@,$(exec_prefix),g' \ | |
78 | -e 's,\@libdir\@,$(libdir),g' \ | |
79 | -e 's,\@includedir\@,$(includedir),g' \ | |
80 | $< >$*.pc | |
6e27f586 JT |
81 | |
82 | CLEANFILES = $(BUILT_SOURCES) $(STAMPS) $(pkgconfig_DATA) | |
1e683bb5 JT |
83 | |
84 | # didn't work (same problem as with _LTLIBRARIES [parsing by automake], | |
85 | # this time _OBJECTS was not correct) | |
86 | # server_SOURCES = server.cpp \ | |
87 | # $(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j))) \ | |
88 | # $(foreach i, $(CMDGROUPS), $(i)_server.cpp) |