From: Jens Thiele Date: Mon, 4 Dec 2006 16:45:27 +0000 (+0000) Subject: projects using libt2n-codegen must include the makefile snippet themselves. X-Git-Tag: v0.2~53 X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=commitdiff_plain;h=d37ba346490f74d11dbd2e676d6968b2cb46af8c projects using libt2n-codegen must include the makefile snippet themselves. --- diff --git a/codegen/Makefile.am b/codegen/Makefile.am index e831e3e..998b67b 100644 --- a/codegen/Makefile.am +++ b/codegen/Makefile.am @@ -5,7 +5,7 @@ libt2n_codegen_SOURCES = main.cpp bin_PROGRAMS = libt2n-codegen -pkgdata_DATA = clientlib.pc.in codegen.make +pkgdata_DATA = clientlib.pc.in # needed because we use old automake not supporting dist_ prefix diff --git a/codegen/TODO b/codegen/TODO index cbc6c1c..a40a06d 100644 --- a/codegen/TODO +++ b/codegen/TODO @@ -1,36 +1,26 @@ - remove support for LIBT2N_EXPORT_GROUP(group) (this will simplify the generator a lot) - add option similar to gccs -MD (at the moment it is a fixed set of files generated and - they are handled in the makefile) + they are handled in the makefile snippet [codegen.make]) open questions: - should projects using the codegen depend on installed version of ... or ship their own version? - * codegen binary: no - * Makefile snippet: no - * codegen-stubhead.hxx -- get rid of codegen-stubhead.hxx or include a "copy" in each project +- get rid of codegen-stubhead.hxx or include a "copy" in each project? + first we said yes but now i say no because the lib depends on the libt2n headers anyway - makefile snippet must work for builds outside of libt2n - (=> some variables must be set by configure, the snippet must be installed - => pc file template must be installed, too) - - the variables which must be set: + => some variables must be set by configure + the variables which must be set: LIBT2N_CODEGEN="\$(top_builddir)/codegen/libt2n-codegen" LIBT2N_CLIENT_PCTEMPLATE="\$(top_srcdir)/codegen/clientlib.pc.in" LIBT2N_CODEGEN_MAKESNIPPET="include \$(top_srcdir)/codegen/codegen.make" - LIBT2N_CODEGEN will be handled by AC_PATH_PROG - the other two? can't we use pkgconfig?! - perhaps best provide a m4 macro for use with autoconf? - - AC_DEFUN([LIBT2N_CODEGEN ... - - alternatively we could add a option --datadir to codegen which prints out the - path to clientlib.pc.in and codegen.make - (first solution is the better one) - - we can use pkg-config => best solution + we store the variables in the .pc file of libt2n + maybe wrap the calls to pkg-config in a m4 macro + (=> projects using libt2n-codegen need only one line in configure.in) - it would really be much nicer if the client lib includes would not depend upon boost serialization i thought a solution would be to provide this optionally by wrapping the corresponding includes in a #ifdef but this does not work since command.hxx is included which depends on boost serialization headers anyway => we do not provide this for now +- add example using a generated client library + (=> depends on installed example) diff --git a/configure.in b/configure.in index 5086b6f..1b30c42 100644 --- a/configure.in +++ b/configure.in @@ -32,13 +32,11 @@ LIBT2N_CFLAGS="-I\$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I\$(top_s LIBT2N_LIBS="\$(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@" LIBT2N_CODEGEN="\$(top_builddir)/codegen/libt2n-codegen" LIBT2N_CLIENT_PCTEMPLATE="\$(top_srcdir)/codegen/clientlib.pc.in" -LIBT2N_CODEGEN_MAKESNIPPET="include \$(top_srcdir)/codegen/codegen.make" AC_SUBST(LIBT2N_CFLAGS) AC_SUBST(LIBT2N_LIBS) AC_SUBST(LIBT2N_CODEGEN) AC_SUBST(LIBT2N_CLIENT_PCTEMPLATE) -AC_SUBST(LIBT2N_CODEGEN_MAKESNIPPET) dnl todo: do not create .pc file in configure but in make dnl see also autoconf manual "Installation Directory Variables" diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index a4195d4..d5670f3 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -1,5 +1,5 @@ # not a GNU package. You can remove this line, if -# have all needed files, that a GNU package needs +# you have all needed files, that a GNU package needs AUTOMAKE_OPTIONS = foreign 1.4 INCLUDES = @LIBT2N_CFLAGS@ @@ -42,13 +42,10 @@ TESTS = test EXTRA_DIST = $(TESTS) configure.in -# we have got an old automake version (1.4-p5) which doesn't support nodist_ -# => you might want to use the dist-hook to remove generated files -dist-hook: - rm -vf $(foreach i, $(LIBT2N_CODEGEN_BUILT), $(distdir)/$(i)) - # if you use libt2n-codegen you should add this -@LIBT2N_CODEGEN_MAKESNIPPET@ - -CLEANFILES = $(LIBT2N_SUGGESTED_CLEANFILES) - +# (i did not find a nice way to let libt2n install this makefile snippet +# and let projects using libt2n use the installed version. +# the core of the problem is: +# the makefile snippet is already needed when automake is run +# => no way to let configure locate the snippet) +include codegen.make diff --git a/example-codegen/TODO b/example-codegen/TODO index 53f0f9e..327fedf 100644 --- a/example-codegen/TODO +++ b/example-codegen/TODO @@ -22,3 +22,18 @@ now we use the first solution - dist-hook in included makefile does not work (because automake doesn't see it!) - CLEANFILES doesn't work in included makefile either + +BUG: +- first time builds without dependency files fail (.P)! + maybe yet another problem caused by automake? + probably yes + AHH: + automake supports include + the real problem is: at the time automake runs there is no include! + (since it is "added" by the configure script) + + => the real problem: + configure should find the make file snippet + Makefile.am should include it + automake is run before configure (on the Makefile.am) + diff --git a/codegen/codegen.make b/example-codegen/codegen.make similarity index 82% rename from codegen/codegen.make rename to example-codegen/codegen.make index 747ed31..add7355 100644 --- a/codegen/codegen.make +++ b/example-codegen/codegen.make @@ -6,11 +6,12 @@ include_HEADERS += $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx) -#IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j))) +# not needed but nice to have +# IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j))) -include $(foreach i, $(CMDGROUPS), libt2ngroup_$(i).P) -libt2ngroup_%.P : Makefile +libt2ngroup_%.P : Makefile.am echo $@ : $($*_GROUP) > libt2ngroup_$*.P %.libt2nstamp : libt2ngroup_%.P $(LIBT2N_CODEGEN) @@ -45,10 +46,7 @@ pkgconfig_DATA = $(CMDGROUPS:=.pc) -e 's,\@includedir\@,$(includedir),g' \ $< >$*.pc -LIBT2N_SUGGESTED_CLEANFILES = $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) - -# doesn't work -# CLEANFILES = $(LIBT2N_SUGGESTED_CLEANFILES) +CLEANFILES += $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) # didn't work (same problem as with _LTLIBRARIES [parsing by automake], # this time _OBJECTS was not correct) @@ -58,6 +56,7 @@ LIBT2N_SUGGESTED_CLEANFILES = $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconf # we have got an old automake version (1.4-p5) which doesn't support nodist_ # => we use the dist-hook -# unfortunately dist-hook only works if directly visible for automake (=> not in this include) -#dist-hook: -# rm -vf $(foreach i, $(BUILT_SOURCES), $(distdir)/$(i)) +dist-hook: + rm -vf $(foreach i, $(LIBT2N_CODEGEN_BUILT), $(distdir)/$(i)) + +EXTRA_DIST += codegen.make diff --git a/example-codegen/configure.in b/example-codegen/configure.in index e02f97f..fc39e9f 100644 --- a/example-codegen/configure.in +++ b/example-codegen/configure.in @@ -13,9 +13,7 @@ PKG_CHECK_MODULES(LIBT2N, libt2n = 0.1) LIBT2N_CODEGEN=`$PKG_CONFIG --variable libt2n_codegen libt2n` LIBT2N_DATADIR=`$PKG_CONFIG --variable libt2n_datadir libt2n` LIBT2N_CLIENT_PCTEMPLATE="$LIBT2N_DATADIR/clientlib.pc.in" -LIBT2N_CODEGEN_MAKESNIPPET="include $LIBT2N_DATADIR/codegen.make" AC_SUBST(LIBT2N_CODEGEN) AC_SUBST(LIBT2N_CLIENT_PCTEMPLATE) -AC_SUBST(LIBT2N_CODEGEN_MAKESNIPPET) AC_OUTPUT(Makefile)