forked from zeromq/zproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zproject_automake.gsl
186 lines (151 loc) · 4.01 KB
/
zproject_automake.gsl
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
.# ===========================================================================
.# Generate automake files for project
.#
.# This is a code generator built using the iMatix GSL code generation
.# language. See https://github.com/imatix/gsl for details. This script
.# is licensed under MIT/X11.
.#
.# This script will generate the following files:
.# * Makefile.am
.# * src/Makemodule.am
.# ===========================================================================
.echo "Generating Makefile.am..."
.output "Makefile.am"
$(project.GENERATED_WARNING_HEADER:)
ACLOCAL_AMFLAGS = -I config
AM_CPPFLAGS = \\
.for use
\${$(use.project)_CFLAGS} \\
.endfor
-I\$(srcdir)/include
.if count (use) > 0
project_libs = \\
.else
project_libs =
.endif
.for use
. if last()
\${$(use.project)_LIBS}
. else
\${$(use.project)_LIBS} \\
. endif
.endfor
SUBDIRS =
.if count (class) > 0
SUBDIRS += doc
.endif
DIST_SUBDIRS =
lib_LTLIBRARIES =
bin_PROGRAMS =
check_PROGRAMS =
EXTRA_DIST = \\
.for project.extra
$(extra.name) \\
.endfor
version.sh
include \$(srcdir)/src/Makemodule.am
$(project.GENERATED_WARNING_HEADER:)
.echo "Generating src/Makemodule.am..."
.if !file.exists ("src")
. directory.create("src")
.endif
.output "src/Makemodule.am"
$(project.GENERATED_WARNING_HEADER:)
.if (count (class) > 0)
program_libs = \\
.if count (use) > 0
src/lib$(project.prefix).la \\
${project_libs}
.else
src/lib$(project.prefix).la
.endif
lib_LTLIBRARIES += src/lib$(project.prefix).la
pkgconfig_DATA = src/lib$(project.prefix).pc
include_HEADERS = \\
.if count (class, class.name = project.name) = 0
include/$(project.name).h \\
.endif
.for header
include/$(name).h \\
.endfor
.for class where !defined (class.private)
. class.classdir = "include"
$(classdir)/$(name).h \\
.endfor
include/$(project.prefix)_library.h
src_lib$(project.prefix)_la_SOURCES = \\
.for class
src/$(name).c \\
.endfor
.for extra
src/$(name) \\
.endfor
src/platform.h
src_lib$(project.prefix)_la_CPPFLAGS = ${AM_CPPFLAGS}
src_lib$(project.prefix)_la_LDFLAGS = \\
-version-info @LTVER@ \\
\$(LIBTOOL_EXTRA_LDFLAGS)
if ON_MINGW
src_lib$(project.prefix)_la_LDFLAGS += \\
-no-undefined \\
-avoid-version
endif
src_lib$(project.prefix)_la_LIBADD = ${project_libs}
.for project.main
bin_PROGRAMS += src/$(main.name)
src_$(main.name)_CPPFLAGS = ${AM_CPPFLAGS}
src_$(main.name)_LDADD = ${program_libs}
src_$(name)_SOURCES = src/$(name).c
.endfor
check_PROGRAMS += src/$(project.prefix)_selftest
src_$(project.prefix)_selftest_CPPFLAGS = \${src_lib$(project.prefix)_la_CFLAGS}
src_$(project.prefix)_selftest_LDADD = ${program_libs}
src_$(project.prefix)_selftest_SOURCES = src/$(project.prefix)_selftest.c
TESTS = src/$(project.prefix)_selftest
.else
noinst_LTLIBRARIES =
noinst_PROGRAMS =
TESTS =
.endif
.for bin
. if first()
# Install data into /usr/local/bin
$(project.name)dir = @bindir@
$(project.name)_SCRIPTS = \\
. endif
. if !last()
$(bin.name) \\
. else
$(bin.name)
. endif
.endfor
.if (count (class) > 0)
# define custom target for all products of /src
src: src/lib$(project.prefix).la src/$(project.prefix)_selftest
.endif
.for model
. if first ()
# Produce generated code from models in the src directory
code:
. endif
. if defined (model.script)
\tcd $\(srcdir)/src; gsl -topdir:.. -script:$(script:) \
. for model.param
-$(param.name):$(param.value) \
. endfor
-q $(name).xml
. else
\tcd $\(srcdir)/src; gsl -q $(name).xml
. endif
.endfor
# Run the selftest binary under valgrind to check for memory leaks
memcheck: src/$(project.prefix)_selftest
\tlibtool --mode=execute valgrind --tool=memcheck \\
\t\t--leak-check=full --show-reachable=yes --error-exitcode=1 \\
\t\t--suppressions=$\(srcdir)/src/.valgrind.supp \\
\t\t$\(srcdir)/src/$(project.prefix)_selftest
# Run the selftest binary under gdb for debugging
debug: src/$(project.prefix)_selftest
\tlibtool --mode=execute gdb -q \\
\t\t$\(srcdir)/src/$(project.prefix)_selftest
$(project.GENERATED_WARNING_HEADER:)