~ubuntu-branches/ubuntu/quantal/pgbouncer/quantal-security

« back to all changes in this revision

Viewing changes to lib/mk/temos/expected/antimake3.txt

  • Committer: Package Import Robot
  • Author(s): Christoph Berg, Peter Eisentraut, Christoph Berg
  • Date: 2012-01-27 17:40:22 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120127174022-zrp5nr3h6lwi5l1e
Tags: 1.5-1
[ Peter Eisentraut ]
* Update watch file to allow .tar.gz in addition to .tgz
* Remove obsolete README.source and repack support in watch file

[ Christoph Berg ]
* New upstream release.
* Use start-stop-daemon for stopping the daemon.  Closes: #641568.
* Use pgbouncer -R to restart in place, thanks Cody Cutrer for the patch.
  Closes: #657204.
* Update URL in README.Debian.  Closes: #655283.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
= Test Antimake EMBED_SUBDIRS =
 
3
 
 
4
 
 
5
Antimake variable `EMBED_SUBDIRS` list names of directories that
 
6
contains Makefile fragmants that are to be embedded into current
 
7
Makefile.
 
8
 
 
9
- Plus: Proper dependencies, work well with parallel Make.
 
10
- Minus: Cannot go into subdir and run make there.
 
11
- Minus: Fragments are not stand-alone, so need some care when writing.
 
12
 
 
13
 
 
14
== Intro to EMBED_SUBDIRS ==
 
15
 
 
16
 
 
17
To better understand what EMBED_SUBDIRS does, let\'s start with simple
 
18
case - single Makefile that references files under subdir:
 
19
 
 
20
---------------------------------
 
21
$ mkdir -p src
 
22
$ cp ../../antimake.mk .
 
23
---------------------------------
 
24
.File: Makefile
 
25
[source,makefile]
 
26
-----------------------------------
 
27
bin_PROGRAMS = src/myprog
 
28
src_myprog_SOURCES = src/myprog.c
 
29
include antimake.mk
 
30
-----------------------------------
 
31
.File: src/myprog.c
 
32
[source,c]
 
33
-----------------------------------
 
34
#include <stdio.h>
 
35
 
 
36
int main(void)
 
37
{
 
38
        printf("myprog\n");
 
39
        return 0;
 
40
}
 
41
-----------------------------------
 
42
---------------------------------
 
43
$ make
 
44
     CC       src/myprog.c
 
45
     CCLD     src/myprog
 
46
$ ./src/myprog
 
47
myprog
 
48
$ make clean
 
49
     CLEAN    src/myprog
 
50
---------------------------------
 
51
 
 
52
Now you can put the lines that reference files under `src/`
 
53
also into `src` and include that from top-level Makefile:
 
54
 
 
55
.File: src/Makefile.inc
 
56
-----------------------------------
 
57
bin_PROGRAMS = src/myprog
 
58
src_myprog_SOURCES = src/myprog.c
 
59
-----------------------------------
 
60
.File: Makefile
 
61
[source,makefile]
 
62
-----------------------------------
 
63
include src/Makefile.inc
 
64
include antimake.mk
 
65
-----------------------------------
 
66
---------------------------------
 
67
$ make
 
68
     CC       src/myprog.c
 
69
     CCLD     src/myprog
 
70
$ ./src/myprog
 
71
myprog
 
72
---------------------------------
 
73
 
 
74
This works but the problem is that although the Makefile is local,
 
75
it still sees files from top-Makefile-level.  So that is what `EMBED_SUBDIRS`
 
76
helps with - it allow to use local filenames in Makefile fragment,
 
77
and it converts them to top-level filenames when including.  It knows
 
78
only few type of variables it needs to convert:
 
79
 
 
80
- target filenames in primares lists (*_PROGRAMS, *_LIBRARIES, etc)
 
81
- target_SOURCES: foo_SOURCES -> sub_dir_foo_SOURCES with filename conversion
 
82
- other target variables: `foo_*` -> `sub_dir_foo_*` without filename conversion
 
83
- EXTRA_DIST, CLEANFILES, DISTCLEANFILES, MAINTAINERCLEANFILES
 
84
 
 
85
Any other variables stay untouched, and obviously they can mess up top-level variables.
 
86
So the included Makefile should be as clean as possible.
 
87
 
 
88
 
 
89
== Setup source tree for EMBED_SUBDIRS ==
 
90
 
 
91
 
 
92
Setup directories, install Antimake
 
93
 
 
94
---------------------------------
 
95
$ mkdir -p lib1/sublib lib2
 
96
$ cp ../../antimake.mk .
 
97
---------------------------------
 
98
 
 
99
Prepare sources
 
100
 
 
101
.File: main.c
 
102
[source,c]
 
103
-----------------------------------
 
104
#include <stdio.h>
 
105
 
 
106
void func1(void);
 
107
void func2(void);
 
108
void func3(void);
 
109
 
 
110
int main(void)
 
111
{
 
112
        func1();
 
113
        func2();
 
114
        func3();
 
115
        printf("main\n");
 
116
        return 0;
 
117
}
 
118
-----------------------------------
 
119
.File: lib1/func1.c
 
120
[source,c]
 
121
-----------------------------------
 
122
#include <stdio.h>
 
123
 
 
124
void func1(void)
 
125
{
 
126
        printf("func1\n");
 
127
}
 
128
-----------------------------------
 
129
.File: lib1/sublib/func2.c
 
130
[source,c]
 
131
-----------------------------------
 
132
#include <stdio.h>
 
133
 
 
134
void func2(void)
 
135
{
 
136
        printf("func2\n");
 
137
}
 
138
-----------------------------------
 
139
.File: lib2/func3.c
 
140
[source,c]
 
141
-----------------------------------
 
142
#include <stdio.h>
 
143
 
 
144
void func3(void)
 
145
{
 
146
        printf("func3\n");
 
147
}
 
148
-----------------------------------
 
149
 
 
150
Prepare Makefiles
 
151
 
 
152
.File: Makefile
 
153
[source,makefile]
 
154
-----------------------------------
 
155
PACKAGE_NAME = test-subdirs
 
156
PACKAGE_VERSION = 1.0
 
157
 
 
158
EMBED_SUBDIRS = lib1 lib1/sublib lib2
 
159
 
 
160
bin_PROGRAMS = prog
 
161
prog_SOURCES = main.c
 
162
prog_LDADD = lib1/func1.a lib1/sublib/func2.a lib2/func3.a
 
163
 
 
164
EXTRA_DIST = Makefile antimake.mk
 
165
 
 
166
include antimake.mk
 
167
-----------------------------------
 
168
.File: lib1/Makefile.am
 
169
-----------------------------------
 
170
noinst_LIBRARIES = func1.a
 
171
func1_a_SOURCES = func1.c
 
172
 
 
173
EXTRA_DIST = Makefile.am
 
174
-----------------------------------
 
175
.File: lib1/sublib/Makefile.am
 
176
-----------------------------------
 
177
noinst_LIBRARIES = func2.a
 
178
func2_a_SOURCES = func2.c
 
179
EXTRA_DIST = Makefile.am
 
180
-----------------------------------
 
181
.File: lib2/Makefile.am
 
182
-----------------------------------
 
183
noinst_LIBRARIES = func3.a
 
184
func3_a_SOURCES = func3.c
 
185
 
 
186
EXTRA_DIST = Makefile.am
 
187
-----------------------------------
 
188
 
 
189
== Building ==
 
190
 
 
191
 
 
192
Build the project
 
193
 
 
194
---------------------------------
 
195
$ make
 
196
     CC       main.c
 
197
     CC       lib1/func1.c
 
198
     AR       lib1/func1.a
 
199
     RANLIB   lib1/func1.a
 
200
     CC       lib1/sublib/func2.c
 
201
     AR       lib1/sublib/func2.a
 
202
     RANLIB   lib1/sublib/func2.a
 
203
     CC       lib2/func3.c
 
204
     AR       lib2/func3.a
 
205
     RANLIB   lib2/func3.a
 
206
     CCLD     prog
 
207
$ ls
 
208
Makefile  antimake.mk  lib1  lib2  main.c  prog  src
 
209
$ ./prog
 
210
func1
 
211
func2
 
212
func3
 
213
main
 
214
---------------------------------
 
215
 
 
216
We can now install it:
 
217
 
 
218
---------------------------------
 
219
$ make install prefix=/opt DESTDIR=./inst
 
220
     INSTALL  prog ./inst/opt/bin
 
221
$ ls ./inst/opt/bin
 
222
prog
 
223
---------------------------------
 
224
 
 
225
Now we can create package that can be given to others.
 
226
 
 
227
---------------------------------
 
228
$ make dist
 
229
     CHECK    dist-gzip
 
230
     MKDIR    test-subdirs-1.0
 
231
     COPY     test-subdirs-1.0
 
232
     PACK     test-subdirs-1.0.tar.gz
 
233
$ ls
 
234
Makefile     inst  lib2    prog  test-subdirs-1.0.tar.gz
 
235
antimake.mk  lib1  main.c  src
 
236
$ tar tzf test-subdirs-1.0.tar.gz | sort
 
237
test-subdirs-1.0/
 
238
test-subdirs-1.0/Makefile
 
239
test-subdirs-1.0/antimake.mk
 
240
test-subdirs-1.0/lib1/
 
241
test-subdirs-1.0/lib1/Makefile.am
 
242
test-subdirs-1.0/lib1/func1.c
 
243
test-subdirs-1.0/lib1/sublib/
 
244
test-subdirs-1.0/lib1/sublib/Makefile.am
 
245
test-subdirs-1.0/lib1/sublib/func2.c
 
246
test-subdirs-1.0/lib2/
 
247
test-subdirs-1.0/lib2/Makefile.am
 
248
test-subdirs-1.0/lib2/func3.c
 
249
test-subdirs-1.0/main.c
 
250
---------------------------------
 
251
 
 
252
Clean the tree
 
253
 
 
254
---------------------------------
 
255
$ make clean
 
256
     CLEAN    prog
 
257
     CLEAN    lib1/func1.a
 
258
     CLEAN    lib1/sublib/func2.a
 
259
     CLEAN    lib2/func3.a
 
260
     CLEAN    clean
 
261
$ ls
 
262
Makefile  antimake.mk  inst  lib1  lib2  main.c  src  test-subdirs-1.0.tar.gz
 
263
---------------------------------
 
264
 
 
265
Done!
 
266