summaryrefslogtreecommitdiff
path: root/rest/Makefile.am
blob: 35067c505858800fb3c107b924b466a0e60ff03a (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
CLEANFILES =

# For some reason I can't use $(librest_@API_VERSION@_la_SOURCES) in
# test_runner_SOURCES, so we have to do this
lib_sources = \
	rest-param.c			\
	rest-params.c			\
	rest-proxy.c 			\
	rest-proxy-call.c		\
	rest-proxy-call-private.h	\
	rest-xml-node.c			\
	rest-xml-parser.c		\
	rest-main.c			\
	rest-private.h			\
	rest-enum-types.c		\
	oauth-proxy.c			\
	oauth-proxy-call.c		\
	oauth-proxy-private.h 		\
	oauth2-proxy.c			\
	oauth2-proxy-call.c		\
	oauth2-proxy-private.h
lib_headers = \
	rest-param.h		\
	rest-params.h		\
	rest-proxy.h		\
	rest-proxy-call.h	\
	rest-enum-types.h	\
	oauth-proxy.h		\
	oauth-proxy-call.h	\
	oauth2-proxy.h		\
	oauth2-proxy-call.h	\
	rest-xml-node.h		\
	rest-xml-parser.h

lib_LTLIBRARIES = librest-@API_VERSION@.la
librest_@API_VERSION@_la_CFLAGS = $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) \
		    $(SOUP_CFLAGS) $(SOUP_GNOME_CFLAGS) \
		    $(XML_CFLAGS) $(GCOV_CFLAGS) \
		    -I$(top_srcdir) -Wall -DG_LOG_DOMAIN=\"Rest\"
librest_@API_VERSION@_la_LDFLAGS = -no-undefined
librest_@API_VERSION@_la_LIBADD = $(GLIB_LIBS) $(GTHREAD_LIBS) \
                    $(SOUP_LIBS) $(SOUP_GNOME_LIBS) $(XML_LIBS) \
		    $(GCOV_LDFLAGS)
librest_@API_VERSION@_la_SOURCES = $(lib_sources) $(lib_headers)
librest_@API_VERSION@_la_HEADERS = $(lib_headers)
librest_@API_VERSION@_ladir = $(includedir)/rest-@API_VERSION@/rest

rest-enum-types.h: stamp-rest-enum-types.h
	@true

stamp-rest-enum-types.h: rest-proxy.h rest-proxy-call.h Makefile
	$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) \
			--fhead "#ifndef __REST_ENUM_TYPES_H__\n#define __REST_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) G_GNUC_CONST;\n#define REST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
			--ftail "G_END_DECLS\n\n#endif /* __REST_ENUM_TYPES_H__ */" rest-proxy.h rest-proxy-call.h) >> xgen-gtbh \
	&& (cmp -s xgen-gtbh rest-enum-types.h || cp xgen-gtbh rest-enum-types.h ) \
	&& rm -f xgen-gtbh \
	&& echo timestamp > $(@F)

rest-enum-types.c: rest-proxy.h rest-proxy-call.h Makefile rest-enum-types.h
	$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) \
			--fhead "#include \"rest-proxy.h\"\n#include \"rest-proxy-call.h\"\n#include \"rest-enum-types.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@\", \"@valuenick@\" }," \
			--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
		rest-proxy.h rest-proxy-call.h) > xgen-gtbc \
	&& cp xgen-gtbc rest-enum-types.c  \
	&& rm -f xgen-gtbc


# Test suite
TESTS = test-runner
check_PROGRAMS = test-runner

test_runner_SOURCES = test-runner.c $(lib_sources) $(lib_headers)
test_runner_CFLAGS = -DBUILD_TESTS $(librest_@API_VERSION@_la_CFLAGS) $(GCOV_CFLAGS)
test_runner_LDFLAGS = $(librest_@API_VERSION@_la_LIBADD) $(GCOV_LDFLAGS)

# TODO: use gtester

# intospection
-include $(INTROSPECTION_MAKEFILE)

if HAVE_INTROSPECTION
INTROSPECTION_GIRS = Rest-@API_VERSION@.gir

Rest-@API_VERSION@.gir: librest-@API_VERSION@.la Makefile

Rest_@API_VERSION_AM@_gir_NAMESPACE = Rest
Rest_@API_VERSION_AM@_gir_VERSION = @API_VERSION@
Rest_@API_VERSION_AM@_gir_LIBS = librest-@API_VERSION@.la
Rest_@API_VERSION_AM@_gir_FILES = \
	$(lib_headers) \
	$(filter-out %private.h, $(lib_sources))
Rest_@API_VERSION_AM@_gir_CFLAGS = -I$(top_srcdir)
Rest_@API_VERSION_AM@_gir_INCLUDES = GObject-2.0 Gio-2.0
Rest_@API_VERSION_AM@_gir_PACKAGES = gobject-2.0 libsoup-2.4 libxml-2.0 gio-2.0
Rest_@API_VERSION_AM@_gir_SCANNERFLAGS = --accept-unprefixed
Rest_@API_VERSION_AM@_gir_EXPORT_PACKAGES = rest-@API_VERSION@
REST_CINCLUDES=$(patsubst %,--c-include='rest/%',$(shell echo $(lib_headers)))
INTROSPECTION_SCANNER_ARGS = $(REST_CINCLUDES)

girdir = $(datadir)/gir-1.0
dist_gir_DATA = $(INTROSPECTION_GIRS)

typelibsdir = $(libdir)/girepository-1.0/
typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)

CLEANFILES += $(dist_gir_DATA) \
	$(typelibs_DATA) \
	rest-enum-types.h \
	rest-enum-types.c \
	stamp-rest-enum-types.h \
	$(NULL)

endif # HAVE_INTROSPECTION