1CLEANFILES =
2
3# For some reason I can't use $(librest_@API_VERSION@_la_SOURCES) in
4# test_runner_SOURCES, so we have to do this
5lib_sources = \
6	glib-compat.h			\
7	glib-compat.c			\
8	rest-param.c			\
9	rest-params.c			\
10	rest-proxy.c 			\
11	rest-proxy-auth.c		\
12	rest-proxy-auth-private.h	\
13	rest-proxy-call.c		\
14	rest-proxy-call-private.h	\
15	rest-xml-node.c			\
16	rest-xml-parser.c		\
17	rest-main.c			\
18	rest-private.h			\
19	rest-enum-types.c		\
20	oauth-proxy.c			\
21	oauth-proxy-call.c		\
22	oauth-proxy-private.h 		\
23	oauth2-proxy.c			\
24	oauth2-proxy-call.c		\
25	oauth2-proxy-private.h 		\
26	sha1.c				\
27	sha1.h
28nodist_lib_sources = \
29	rest-marshal.h		\
30	rest-marshal.c
31lib_headers = \
32	rest-param.h		\
33	rest-params.h		\
34	rest-proxy.h		\
35	rest-proxy-auth.h	\
36	rest-proxy-call.h	\
37	rest-enum-types.h	\
38	oauth-proxy.h		\
39	oauth-proxy-call.h	\
40	oauth2-proxy.h		\
41	oauth2-proxy-call.h	\
42	rest-xml-node.h		\
43	rest-xml-parser.h
44
45EXTRA_DIST = \
46	rest-marshal.txt
47
48lib_LTLIBRARIES = librest-@API_VERSION@.la
49librest_@API_VERSION@_la_CFLAGS = $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) \
50		    $(SOUP_CFLAGS) $(SOUP_GNOME_CFLAGS) \
51		    $(XML_CFLAGS) $(GCOV_CFLAGS) \
52		    -I$(top_srcdir) -Wall -DG_LOG_DOMAIN=\"Rest\"
53librest_@API_VERSION@_la_LDFLAGS = -no-undefined
54librest_@API_VERSION@_la_LIBADD = $(GLIB_LIBS) $(GTHREAD_LIBS) \
55                    $(SOUP_LIBS) $(SOUP_GNOME_LIBS) $(XML_LIBS) \
56		    $(GCOV_LDFLAGS)
57librest_@API_VERSION@_la_SOURCES = $(lib_sources) $(lib_headers)
58nodist_librest_@API_VERSION@_la_SOURCES = $(nodist_lib_sources)
59librest_@API_VERSION@_la_HEADERS = $(lib_headers)
60librest_@API_VERSION@_ladir = $(includedir)/rest-@API_VERSION@/rest
61
62rest-enum-types.h: stamp-rest-enum-types.h
63	@true
64
65stamp-rest-enum-types.h: rest-proxy.h rest-proxy-call.h Makefile
66	$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) \
67			--fhead "#ifndef __REST_ENUM_TYPES_H__\n#define __REST_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
68			--fprod "/* enumerations from \"@filename@\" */\n" \
69			--vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define REST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
70			--ftail "G_END_DECLS\n\n#endif /* __REST_ENUM_TYPES_H__ */" rest-proxy.h rest-proxy-call.h) >> xgen-gtbh \
71	&& (cmp -s xgen-gtbh rest-enum-types.h || cp xgen-gtbh rest-enum-types.h ) \
72	&& rm -f xgen-gtbh \
73	&& echo timestamp > $(@F)
74
75rest-enum-types.c: rest-proxy.h rest-proxy-call.h Makefile rest-enum-types.h
76	$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) \
77			--fhead "#include \"rest-proxy.h\"\n#include \"rest-proxy-call.h\"\n#include \"rest-enum-types.h\"" \
78			--fprod "\n/* enumerations from \"@filename@\" */" \
79			--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[] = {" \
80			--vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
81			--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
82		rest-proxy.h rest-proxy-call.h) > xgen-gtbc \
83	&& cp xgen-gtbc rest-enum-types.c  \
84	&& rm -f xgen-gtbc
85
86BUILT_SOURCES = rest-marshal.c rest-marshal.h
87
88rest-marshal.c: rest-marshal.txt
89	$(AM_V_GEN)echo "#include \"rest-marshal.h\"" > $@ && \
90		glib-genmarshal --body $< >> $@ || (rm -f $@ && exit 1)
91
92rest-marshal.h: rest-marshal.txt
93	$(AM_V_GEN)glib-genmarshal --header $< > $@ || (rm -f $@ && exit 1)
94
95
96# Test suite
97TESTS = test-runner
98check_PROGRAMS = test-runner
99
100test_runner_SOURCES = test-runner.c $(lib_sources) $(nodist_lib_sources) $(lib_headers)
101test_runner_CFLAGS = -DBUILD_TESTS $(librest_@API_VERSION@_la_CFLAGS) $(GCOV_CFLAGS)
102test_runner_LDFLAGS = $(librest_@API_VERSION@_la_LIBADD) $(GCOV_LDFLAGS)
103
104# TODO: use gtester
105
106# intospection
107-include $(INTROSPECTION_MAKEFILE)
108
109if HAVE_INTROSPECTION
110INTROSPECTION_GIRS = Rest-@API_VERSION@.gir
111
112Rest-@API_VERSION@.gir: librest-@API_VERSION@.la Makefile
113
114Rest_@API_VERSION_AM@_gir_NAMESPACE = Rest
115Rest_@API_VERSION_AM@_gir_VERSION = @API_VERSION@
116Rest_@API_VERSION_AM@_gir_LIBS = librest-@API_VERSION@.la
117Rest_@API_VERSION_AM@_gir_FILES = \
118	$(lib_headers) \
119	$(filter-out %private.h, $(lib_sources))
120Rest_@API_VERSION_AM@_gir_CFLAGS = -I$(top_srcdir)
121Rest_@API_VERSION_AM@_gir_INCLUDES = GObject-2.0 Gio-2.0 Soup-2.4
122Rest_@API_VERSION_AM@_gir_PACKAGES = gobject-2.0 libsoup-2.4 libxml-2.0 gio-2.0
123Rest_@API_VERSION_AM@_gir_SCANNERFLAGS = --accept-unprefixed --warn-all
124Rest_@API_VERSION_AM@_gir_EXPORT_PACKAGES = rest-@API_VERSION@
125REST_CINCLUDES=$(patsubst %,--c-include='rest/%',$(shell echo $(lib_headers)))
126INTROSPECTION_SCANNER_ARGS = $(REST_CINCLUDES)
127
128girdir = $(datadir)/gir-1.0
129dist_gir_DATA = $(INTROSPECTION_GIRS)
130
131typelibsdir = $(libdir)/girepository-1.0/
132typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
133
134CLEANFILES += $(dist_gir_DATA) \
135	$(typelibs_DATA) \
136	rest-enum-types.h \
137	rest-enum-types.c \
138	stamp-rest-enum-types.h \
139	$(NULL)
140
141endif # HAVE_INTROSPECTION
142