]> git.meshlink.io Git - catta/blob - avahi-glib/Makefile.am
7931bd9e3d122dc93b5b98a04413ff956b7771cd
[catta] / avahi-glib / Makefile.am
1 # $Id$
2 #
3 # This file is part of avahi.
4 #
5 # avahi is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation; either version 2 of the
8 # License, or (at your option) any later version.
9 #
10 # avahi is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 # License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with avahi; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 # USA.
19
20 AM_CFLAGS=-I$(top_srcdir)
21
22 # This cool debug trap works on i386/gcc only
23 AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
24
25 if HAVE_GLIB
26
27 avahiincludedir=$(includedir)/avahi-glib
28
29 avahiinclude_HEADERS = \
30         glib-watch.h \
31         glib-malloc.h
32
33 lib_LTLIBRARIES = \
34         libavahi-glib.la
35
36 if ENABLE_TESTS
37 noinst_PROGRAMS = \
38         glib-watch-test
39 endif
40
41 libavahi_glib_la_SOURCES = \
42         glib-watch.c glib-watch.h \
43         glib-malloc.h glib-malloc.c
44
45 libavahi_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
46 libavahi_glib_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(GLIB20_LIBS)
47 libavahi_glib_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_GLIB_VERSION_INFO)
48
49 glib_watch_test_SOURCES = \
50         glib-watch.c glib-watch.h \
51         glib-watch-test.c
52 glib_watch_test_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
53 glib_watch_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(GLIB20_LIBS)
54
55 if HAVE_GOBJECT
56
57 avahiinclude_HEADERS += \
58         ga-client.h \
59         ga-entry-group.h \
60         ga-enums.h \
61         ga-errors.h \
62         ga-record-browser.h \
63         ga-service-browser.h \
64         ga-service-resolver.h
65
66 lib_LTLIBRARIES += \
67         libavahi-gobject.la
68
69 BUILT_SOURCES = \
70         signals-marshal.list \
71         signals-marshal.h \
72         signals-marshal.c \
73         ga-client-enumtypes.h \
74         ga-client-enumtypes.c  \
75         ga-entry-group-enumtypes.h \
76         ga-entry-group-enumtypes.c  \
77         ga-enums-enumtypes.h \
78         ga-enums-enumtypes.c
79
80 CORE_SOURCES = \
81         ga-client.c ga-client.h \
82         ga-entry-group.c ga-entry-group.h \
83         ga-enums.h \
84         ga-errors.c ga-errors.h \
85         ga-record-browser.c ga-record-browser.h \
86         ga-service-browser.c ga-service-browser.h \
87         ga-service-resolver.c ga-service-resolver.h
88
89 libavahi_gobject_la_SOURCES = \
90         $(CORE_SOURCES) \
91         $(BUILT_SOURCES)
92
93 libavahi_gobject_la_CFLAGS = $(AM_CFLAGS) $(GOBJECT_CFLAGS)
94 libavahi_gobject_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la libavahi-glib.la $(GOJECT_LIBS)
95 libavahi_gobject_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_GOBJECT_VERSION_INFO)
96
97 # correctly clean the generated source files
98 CLEANFILES = $(BUILT_SOURCES)
99
100 dist-hook:
101         $(shell for x in $(BUILT_SOURCES); do rm -f $(distdir)/$$x ; done)
102
103 signals-marshal.list: $(CORE_SOURCES) Makefile.am
104         ( cd $(srcdir) && \
105         sed -n -e 's/.*ga_signals_marshal_\([A-Z]*__[A-Z_]*\).*/\1/p' \
106                 $(CORE_SOURCES) ) \
107                 | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
108         if cmp -s $@.tmp $@; then \
109                 rm $@.tmp; \
110         else \
111                 mv $@.tmp $@; \
112         fi
113
114 signals-marshal.h: signals-marshal.list
115         glib-genmarshal --header --prefix=ga_signals_marshal $< > $@
116
117 signals-marshal.c: signals-marshal.list
118         glib-genmarshal --body --prefix=ga_signals_marshal $< > $@
119
120
121 # rules for making the glib enum objects
122 %-enumtypes.h: %.h Makefile.in
123         glib-mkenums \
124         --fhead "#ifndef __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__\n#define __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
125         --fprod "/* enumerations from \"@filename@\" */\n" \
126         --vhead "GType @enum_name@_get_type (void);\n#define $(shell echo $* | tr [:lower:]- [:upper:]_ | sed 's/_.*//')_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n"         \
127         --ftail "G_END_DECLS\n\n#endif /* __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__ */" \
128         $< > $@
129
130 %-enumtypes.c: %.h Makefile.in
131         glib-mkenums \
132         --fhead "#include <$*.h>" \
133         --fprod "\n/* enumerations from \"@filename@\" */" \
134         --vhead "GType\n@enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G@Type@Value values[] = {"     \
135         --vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@VALUENAME@\" }," \
136         --vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
137         $< > $@
138
139 endif
140
141 endif
142
143 indent:
144         indent -brf -nbbo -nbc -ip0 -cs -nbfde -npsl -br -brs -bap -i4 -bs -cdw -ce -npcs -hnl -cli4 -nut -ci8 ga-*.[ch]