summaryrefslogtreecommitdiffstats
path: root/avahi-gobject/Makefile.am
blob: 02f2b9483b4bbed6a5fa68bf844b50130d888999 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# avahi is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.

AM_CFLAGS=-I$(top_srcdir)

# This cool debug trap works on i386/gcc only
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'

EXTRA_DIST = \
	AvahiCore-0.6.gir

if HAVE_GOBJECT
if HAVE_DBUS

avahigobjectincludedir=$(includedir)/avahi-gobject

avahigobjectinclude_HEADERS = \
	ga-client.h \
	ga-entry-group.h \
	ga-enums.h \
	ga-error.h \
	ga-record-browser.h \
	ga-service-browser.h \
	ga-service-resolver.h

lib_LTLIBRARIES = \
	libavahi-gobject.la

BUILT_SOURCES = \
	signals-marshal.list \
	signals-marshal.h \
	signals-marshal.c \
	ga-client-enumtypes.h \
	ga-client-enumtypes.c  \
	ga-entry-group-enumtypes.h \
	ga-entry-group-enumtypes.c  \
	ga-enums-enumtypes.h \
	ga-enums-enumtypes.c

CORE_SOURCES = \
	ga-client.c ga-client.h \
	ga-entry-group.c ga-entry-group.h \
	ga-enums.h \
	ga-error.c ga-error.h \
	ga-record-browser.c ga-record-browser.h \
	ga-service-browser.c ga-service-browser.h \
	ga-service-resolver.c ga-service-resolver.h

libavahi_gobject_la_SOURCES = \
	$(CORE_SOURCES) \
	$(BUILT_SOURCES)

libavahi_gobject_la_CFLAGS = $(AM_CFLAGS) $(GOBJECT_CFLAGS)
libavahi_gobject_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la ../avahi-glib/libavahi-glib.la $(GOBJECT_LIBS)
libavahi_gobject_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBAVAHI_GOBJECT_VERSION_INFO) -export-symbols-regex '^ga_'

# correctly clean the generated source files
CLEANFILES = $(BUILT_SOURCES)

dist-hook:
	$(shell for x in $(BUILT_SOURCES); do rm -f $(distdir)/$$x ; done)

signals-marshal.list: $(CORE_SOURCES) Makefile.am
	$(AM_V_GEN)( cd $(srcdir) && \
	sed -n -e 's/.*_ga_signals_marshal_\([A-Z]*__[A-Z_]*\).*/\1/p' \
		$(CORE_SOURCES) ) \
		| sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp && \
	if cmp -s $@.tmp $@; then \
		rm $@.tmp; \
	else \
		mv $@.tmp $@; \
	fi

signals-marshal.h: signals-marshal.list
	$(AM_V_GEN)glib-genmarshal --header --prefix=_ga_signals_marshal $< > $@

signals-marshal.c: signals-marshal.list
	$(AM_V_GEN)(echo "#include \"signals-marshal.h\"" ; glib-genmarshal --body --prefix=_ga_signals_marshal $< ) > $@

# rules for making the glib enum objects
%-enumtypes.h: %.h Makefile.in
	$(AM_V_GEN)glib-mkenums \
	--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" \
	--fprod "/* enumerations from \"@filename@\" */\n" \
	--vhead "GType @enum_name@_get_type (void);\n#define $(shell echo $* | tr [:lower:]- [:upper:]_ | sed 's/_.*//')_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n"         \
	--ftail "G_END_DECLS\n\n#endif /* __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__ */" \
	$< > $@

%-enumtypes.c: %.h Makefile.in
	$(AM_V_GEN)glib-mkenums \
	--fhead "#include <$*.h>\n#include<$*-enumtypes.h>" \
	--fprod "\n/* enumerations from \"@filename@\" */" \
	--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[] = {"     \
	--vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@VALUENAME@\" }," \
	--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
	$< > $@

-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)

if HAVE_INTROSPECTION
introspection_sources = $(libavahi_gobject_la_SOURCES)

Avahi-0.6.gir: $(lib_LTLIBRARIES)
Avahi_0_6_gir_INCLUDES = GObject-2.0 AvahiCore-0.6
Avahi_0_6_gir_CFLAGS = $(libavahi_gobject_la_CFLAGS)
Avahi_0_6_gir_LIBS = $(lib_LTLIBRARIES)
Avahi_0_6_gir_FILES = $(addprefix $(srcdir)/, $(CORE_SOURCES)) $(BUILT_SOURCES)
Avahi_0_6_gir_SCANNERFLAGS = --strip-prefix=Ga
INTROSPECTION_GIRS += Avahi-0.6.gir
INTROSPECTION_INSTALL_GIRS = AvahiCore-0.6.gir $(INTROSPECTION_GIRS)

girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_INSTALL_GIRS)

typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_INSTALL_GIRS:.gir=.typelib)

CLEANFILES += $(INTROSPECTION_GIRS) $(typelib_DATA)
endif

endif
endif

indent:
	indent -brf -nbbo -nbc -ip0 -cs -nbfde -npsl -br -brs -bap -i4 -bs -cdw -ce -npcs -hnl -cli4 -nut -ci8 ga-*.[ch]