-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile.am
798 lines (602 loc) · 25.5 KB
/
Makefile.am
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
## Process this file with automake to produce Makefile.in
###############################################################################
## V A R I A B L E S A N D G E N E R A L S E T T I N G S
###############################################################################
# NOTE: Upper case variables may be freely overridden by the user, while lower
# case variables, especially those beginning with an underscore, are for
# internal use only.
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = \
tests \
src
EXTRA_DIST = \
MANUAL.md \
README.md \
autostuff \
bootstrap \
dev \
docs \
mgwmake.bat \
msvcmake.bat \
package.json \
.editorconfig
dist_doc_DATA = \
AUTHORS \
COPYING
_am_installalso_ =
_examples_insthook_ =
if WANT_DEVEL
if WANT_DOC
dist_doc_DATA += \
ChangeLog \
NEWS \
README \
docs/manual.html
if WANT_MAN
notrans_man3_MANS = \
$(MAN3PAGES)
endif WANT_MAN
if WANT_HTML
_am_installalso_ += \
install-html
endif WANT_HTML
endif WANT_DOC
if WANT_EXAMPLES
examplesdir = $(docdir)/examples
dist_examples_SCRIPTS = \
examples/run-example.sh
examplescppdir = $(examplesdir)/cplusplus
dist_examplescpp_DATA = \
examples/cplusplus/map.cpp \
examples/cplusplus/map.hpp \
examples/cplusplus/generic.cpp
examplesinifilesdir = $(examplesdir)/ini_files
dist_examplesinifiles_DATA = \
examples/ini_files/ambiguous.conf \
examples/ini_files/colon_as_delimiter.conf \
examples/ini_files/bad_ini.conf \
examples/ini_files/delivery.conf \
examples/ini_files/extreme_ini.conf \
examples/ini_files/log.ini \
examples/ini_files/hash_table.conf \
examples/ini_files/pacman.conf \
examples/ini_files/self_explaining.conf \
examples/ini_files/toml-like.conf \
examples/ini_files/typed_ini.conf \
examples/ini_files/unix-like.conf
examplesmiscdir = $(examplesdir)/miscellanea
dist_examplesmisc_DATA = \
examples/miscellanea/colon_as_delimiter.c \
examples/miscellanea/disambiguate.c \
examples/miscellanea/dispatch_everything.c \
examples/miscellanea/glib_hash_table.c \
examples/miscellanea/parse_foreign.c \
examples/miscellanea/print_format.c \
examples/miscellanea/stats_only.c \
examples/miscellanea/toml-like.c \
examples/miscellanea/typed_ini.c
examplestopicsdir = $(examplesdir)/topics
dist_examplestopics_DATA = \
examples/topics/ini_array_break.c \
examples/topics/ini_array_collapse.c \
examples/topics/ini_array_foreach.c \
examples/topics/ini_array_release.c \
examples/topics/ini_array_shift.c \
examples/topics/ini_array_split.c \
examples/topics/ini_global_set_implicit_value.c \
examples/topics/ini_string_match_si.c \
examples/topics/ini_string_parse.c \
examples/topics/load_ini_file.c \
examples/topics/load_ini_path.c \
examples/topics/strip_ini_cache.c
exampleutilsdir = $(examplesdir)/utilities
dist_exampleutils_DATA = \
examples/utilities/clone_ini_dispatch.h \
examples/utilities/ini_string_preparse.h \
examples/utilities/load_ini_buffer.h \
examples/utilities/make_strarray.h
if HAVE_TRANSFORMATIONS
# Update example files if the package must coexist with other major versions of
# itself or if it has been renamed
_examples_insthook_ += \
$(SED) -i 's/-l@PROJECT_NAME@/-l@PROJECT_LOCALNAME@/g' \
'$(DESTDIR)$(examplesdir)/run-example.sh' && \
$(FIND) '$(DESTDIR)$(examplesdir)' -type f '(' -name '*.c' -o -name \
'*.h' -o -name '*.cpp' -o -name '*.hpp' ')' -exec $(SED) -i \
's/<@[email protected]>/<@[email protected]>/g' '{}' ';';
endif HAVE_TRANSFORMATIONS
endif WANT_EXAMPLES
endif WANT_DEVEL
# Files/directories erased by `make oblivion-clean`
BINPATH = @PACKAGE_CONFNAME@-@PACKAGE_VERSION@-@host@-pkg
PTBPATH = @PACKAGE_CONFNAME@-@PACKAGE_VERSION@-@host@-builds
SRCPATH = @PACKAGE_TARNAME@-@PACKAGE_VERSION@-src
DEVPATH = @PACKAGE_TARNAME@-@PACKAGE_VERSION@-dev
GITPATH = @PACKAGE_TARNAME@-git
BAKPATH = @PACKAGE_TARNAME@-snapshot
# Other settings
MOSTLYCLEANFILES = \
$(SANDBOX).lst $(SANDBOX).tar $(SANDBOX).tar.gz $(SANDBOX).tar.xz \
$(SANDBOX).tgz $(SANDBOX).txz $(SANDBOX).zip
CLEANFILES = \
dev/tests/null-byte_injection/null-byte_injected.conf \
dev/tests/performance/big_file.ini \
dev/tests/performance/speedtest
# Shell expansion is supported here
_bootstrapclean_dirs_ = \
'autom4te.cache' \
'build-aux' \
'm4' \
`$(FIND) -L . -type d -name .deps`
# Shell expansion is supported here
_bootstrapclean_files_ = \
'aclocal.m4' \
'config'.* \
'configure' \
'configure~' \
'libtool' \
'ltmain.sh' \
`$(FIND) -L . -type f -name 'Makefile.in'`
# Shell expansion is supported here
_oblivionclean_dirs_ = \
'$(distdir)' '$(BINPATH)' '$(PTBPATH)' '$(SRCPATH)' '$(DEVPATH)' \
'$(BAKPATH)' '$(GITPATH)'
# Shell expansion is supported here
_oblivionclean_files_ = \
'$(distdir).shar.gz' '$(distdir).tar.bz2' '$(distdir).tar.gz' \
'$(distdir).tar.lz' '$(distdir).tar.xz' '$(distdir).tar.Z' \
'$(distdir).zip' '$(BINPATH).lst' '$(BINPATH).tar' \
'$(BINPATH).tar.gz' '$(BINPATH).tar.xz' '$(BINPATH).tgz' \
'$(BINPATH).txz' '$(BINPATH).zip' '$(PTBPATH).tar' \
'$(PTBPATH).tar.gz' '$(PTBPATH).tar.xz' '$(PTBPATH).tgz' \
'$(PTBPATH).txz' '$(PTBPATH).zip' '$(SRCPATH).tar' \
'$(SRCPATH).tar.gz' '$(SRCPATH).tar.xz' '$(SRCPATH).tgz' \
'$(SRCPATH).txz' '$(SRCPATH).zip' '$(DEVPATH).tar' \
'$(DEVPATH).tar.gz' '$(DEVPATH).tar.xz' '$(DEVPATH).tgz' \
'$(DEVPATH).txz' '$(DEVPATH).zip' '$(BAKPATH)'*'.tar' \
'$(BAKPATH)'*'.tar.gz' '$(BAKPATH)'*'.tgz' '$(BAKPATH)'*'.tar.xz' \
'$(BAKPATH)'*'.txz' '$(BAKPATH)'*'.zip' '$(GITPATH).tar' \
'$(GITPATH).tar.gz' '$(GITPATH).tar.xz' '$(GITPATH).tgz' \
'$(GITPATH).txz' '$(GITPATH).zip'
INSTALLCHECKS_CPPENV = \
$(TESTSONLY_CPPFLAGS) \
"-DTESTS_CONFINI_HEADER=<@[email protected]>"
# Default compression format (one word only allowed)
ZIPTYPE = tar.gz
# The `install` target to use by default (see, for example `make alldone` and
# `make binary-release` -- one word only allowed)
INSTALLFLAVOR = install-strip
# Default space-separated list of actions for `make beforedone` -- do not
# change this variable here; although the the user can freely change it from
# the command line, in the `Makefile` it must contain targets that support the
# `DESTDIR` variable
FINALJOBS = \
installcheck
# Default target for `make volatile*` (one word only allowed) -- do not change
# this variable here; although the the user can freely change it from the
# command line, in the `Makefile` it must have this value
RUNJOB = $(INSTALLFLAVOR)
# Sandbox default path (one word only allowed)
SANDBOX = volatile
GITFLAGS = \
--quiet \
--progress
###############################################################################
## R E C I P E S P A R T I : D E V E L O P M E N T A N D U S A G E
###############################################################################
# Supplementary targets for GNU Automake
install-html-local: $(srcdir)/docs/html $(srcdir)/docs/index.html
@(cd '$(srcdir)/docs' && $(FIND) -L 'html' -type d -exec $(MKDIR_P) \
'$(DESTDIR)$(htmldir)/{}' \; && $(FIND) -L 'html' -type f -exec \
$(INSTALL_DATA) {} '$(DESTDIR)$(htmldir)/{}' \;) && mv \
'$(DESTDIR)$(htmldir)/html' '$(DESTDIR)$(htmldir)/refbook';
install-data-local: $(_am_installalso_)
install-data-hook:
$(_examples_insthook_)
uninstall-local:
-rm -rf '$(DESTDIR)$(htmldir)' '$(DESTDIR)$(docdir)';
installcheck-local:
@$(MAKE) -C 'tests' clean && $(MAKE) \
AM_CPPFLAGS='$(INSTALLCHECKS_CPPENV) -I$(DESTDIR)$(includedir)' \
autotest_LDADD='-L$(DESTDIR)$(libdir) -l@PROJECT_LOCALNAME@' check;
mostlyclean-local:
-rm -rf '$(SANDBOX)' '._'*;
clean-local:
@transf_clean_recipe@
@revision_clean_recipe@
distclean-local:
@transf_distclean_recipe@
-rm -rf 'help' 'no-dist' '@confnewdir@' '@rvdir@';
dist-hook:
@transf_dist_recipe@
# Novel targets
# Install only the stripped binaries
.PHONY: install-exec-strip
install-exec-strip:
@if test -z '$(STRIP)'; then $(MAKE) $(AM_MAKEFLAGS) \
INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install-exec; else $(MAKE) $(AM_MAKEFLAGS) \
INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install-exec; fi;
# Install/uninstall only the headers
.PHONY: install-headers uninstall-headers
install-headers uninstall-headers:
@$(MAKE) -C 'src' '$@';
# Check that `$(libdir)` and `$(includedir)` work correctly
.PHONY: finishcheck
finishcheck:
@$(MAKE) -C 'tests' clean && $(MAKE) \
AM_CPPFLAGS='$(INSTALLCHECKS_CPPENV)' \
autotest_LDADD='-l@PROJECT_LOCALNAME@' check;
# Let us decide whether stripping or not
.PHONY: nearlydone
nearlydone: $(INSTALLFLAVOR)
# Defaults to `make installcheck` (mostly `Makefile` glue)
.PHONY: beforedone
beforedone: $(FINALJOBS)
# Calls `make $(INSTALLFLAVOR)` followed by `make beforedone`
.PHONY: alldone
alldone: $(INSTALLFLAVOR)
@$(MAKE) beforedone;
# Make the source directory depend on Autotools and a `bootstrap` script
.PHONY: bootstrap-clean
bootstrap-clean: maintainer-clean
-rm -rf $(_bootstrapclean_dirs_); rm -f $(_bootstrapclean_files_); \
(cd '$(srcdir)' && rm -rf $(_bootstrapclean_dirs_); \
rm -f $(_bootstrapclean_files_));
# Call `make bootstrap-clean`, then remove all the archives created
.PHONY: oblivion-clean
oblivion-clean: bootstrap-clean
rm -rf $(_oblivionclean_dirs_); rm -f $(_oblivionclean_files_);
# Merge the files created by `./configure --enable-extended-config=sandbox` and
# update the source code
.PHONY: mergenew
mergenew:
@@mergenew_recipe@
@$(MAKE) all-official-sources;
# Uninstall what `make install` has created, then clean the source directory
.PHONY: clobber
clobber: uninstall clean
# Print the list of common targets
.PHONY: help
help:
@test -f 'help/make-targets.txt' && cat 'help/make-targets.txt' || \
(echo 'Not available. Please launch `$(srcdir)/configure` again.' \
1>&2; exit 2);
# User's rule for forcing non-phony targets to be built, as in `make
# EXPIRE='libconfini-git.tar.gz libconfini-snapshot.tar.gz'
# libconfini-git.tar.gz libconfini-snapshot.tar.gz` or (equivalently) `make
# EXPIRE='libconfini-git.tar.gz libconfini-snapshot.tar.gz' refresh`
.PHONY: $(EXPIRE) refresh
refresh: $(EXPIRE)
###############################################################################
## R E C I P E S P A R T I I: H A C K I N G S
###############################################################################
OFFICIALSRC =
BAREMETALSRC = \
baremetal-source-code
if AUTHOR_MODE
OFFICIALSRC += \
official-source-code
# (Re-)create the official source files
.PHONY: official-source-code
official-source-code:
$(MAKE) -C 'src' 'confini.h' 'confini.c';
if !WANT_BAREMETAL
if HAVE_DLLTOOL
OFFICIALSRC += \
official-symbols
# (Re-)create the official exported symbols
.PHONY: official-symbols
official-symbols:
$(MAKE) -C 'src' '@[email protected]';
endif HAVE_DLLTOOL
endif !WANT_BAREMETAL
# (Re-)create the distributed source files (use `./configure
# --enable-author-mode` for this)
.PHONY: all-official-sources
all-official-sources: $(OFFICIALSRC)
endif AUTHOR_MODE
# Create the "bare metal" version of the source files (launch `./configure
# --wihout-io-api` to use it)
.PHONY: baremetal-source-code
baremetal-source-code:
$(MAKE) -C 'src' 'confini-baremetal.h' 'confini-baremetal.c';
if WANT_BAREMETAL
if HAVE_DLLTOOL
BAREMETALSRC += \
baremetal-symbols
# Create the baremetal exported symbols
.PHONY: baremetal-symbols
baremetal-symbols:
$(MAKE) -C 'src' '@[email protected]';
endif HAVE_DLLTOOL
endif WANT_BAREMETAL
# Create the "bare metal" version of the source files (launch `./configure
# --wihout-io-api` to use it)
.PHONY: all-baremetal-sources
all-baremetal-sources: $(BAREMETALSRC)
# (Re-)create all source files
.PHONY: all-sources
all-sources: $(OFFICIALSRC) $(BAREMETALSRC)
if REVISE_LIBC
CLEANFILES += \
no-dist/hackings/baremetal/c-standard-library.h
# Non-phony special prerequisites
# Defaults to `no-dist/.archived/non-portable.h`
no-dist/.archived/$(nonportfile): no-dist/conf-results/stdmissing.h
@if ! test -f '$(rvdir)/$(nonportfile)'; then $(MKDIR_P) '$(rvdir)'; \
cp 'no-dist/conf-results/stdmissing.h' '$(rvdir)/$(nonportfile)'; { \
echo; echo \
'**Error** I could not recovery the current revision. I am going to use the'; \
echo 'output from the `configure` script to regenerate it...'; echo; \
echo \
'Please revise the content of the `$(rvdir)` subdirectory, then try again.'; \
echo; } 1>&2; exit 2; fi; case ' $(APPROVE) ' in *' revision '*) \
$(MKDIR_P) 'no-dist/.archived'; mv '$(rvdir)/$(nonportfile)' \
'$@'; rmdir '$(rvdir)' 2> /dev/null || :; echo \
'User'\''s revision has been accepted. To undo this, launch `$(MAKE) reject-revision`.'; \
;; *) { echo; echo \
'There are pending revisions. Please revise the content of the `$(rvdir)`'; \
echo \
'subdirectory, then launch `$(MAKE) approve-revision` after you are done.'; \
echo; } >&2; exit 13; ;; esac;
# Non-phony special prerequisite for compiling the package when one or more
# standard data types are not available
no-dist/hackings/baremetal/c-standard-library.h: no-dist/.archived/$(nonportfile)
@echo 'Creating $@...' && $(MKDIR_P) 'no-dist/hackings/baremetal' && \
{ ! test -f 'no-dist/conf-results/noioheaders.h' || cat \
'no-dist/conf-results/noioheaders.h'; cat \
'no-dist/.archived/$(nonportfile)'; } > '$@';
# Defaults to `make REVISEME/non-portable.h`
$(rvdir)/$(nonportfile): no-dist/conf-results/stdmissing.h no-dist/.archived/$(nonportfile)
@$(MKDIR_P) '$(rvdir)'; test -f 'no-dist/.archived/$(nonportfile)' && \
mv 'no-dist/.archived/$(nonportfile)' '$@' || cp \
'no-dist/conf-results/stdmissing.h' '$@'; echo \
'User'\''s revision has been rejected.';
# Phony special targets
.PHONY: approve-revision
approve-revision:
@$(MAKE) APPROVE='revision' \
'no-dist/hackings/baremetal/c-standard-library.h' \
baremetal-source-code;
.PHONY: reject-revision
reject-revision: $(rvdir)/$(nonportfile)
endif REVISE_LIBC
###############################################################################
## R E C I P E S P A R T I I I: A N A L Y S I S
###############################################################################
# Various `sandbox-*` phony targets... Each of them (except the `*check` ones)
# must erase and rebuild the `volatile` directory (or an alternative directory
# if a `SANDBOX` variable is passed to `make` - as in `make SANDBOX='man-pkg'
# sandbox-install-man`).
# For internal use they serve several purposes, while for public use they are
# mostly sugar targets for invoking `make install*` with a relative path as
# `DESTDIR` (by passing a `SANDBOX` variable), or unpacking the various
# distribution targets into a volatile directory.
.PHONY: sandbox-void
sandbox-void: ;
.PHONY: sandbox-erase
sandbox-erase:
@rm -rf '$(SANDBOX)';
.PHONY: sandbox-blank
sandbox-blank: sandbox-erase
@$(MKDIR_P) '$(SANDBOX)';
.PHONY: sandbox-beforedone
sandbox-beforedone: $(SANDBOX)
@_FULLPATH="$$(cd '$(SANDBOX)' && pwd)" && $(MAKE) \
DESTDIR="$${_FULLPATH}" $(FINALJOBS);
.PHONY: sandbox-installcheck
sandbox-installcheck: $(SANDBOX)
@$(MAKE) FINALJOBS='installcheck' sandbox-beforedone;
.PHONY: sandbox-install
sandbox-install: sandbox-blank
@$(MAKE) RUNJOB='void' FINALJOBS='install' sandbox-beforedone;
.PHONY: sandbox-install-strip
sandbox-install-strip: sandbox-blank
@$(MAKE) RUNJOB='void' FINALJOBS='install-strip' sandbox-beforedone;
.PHONY: sandbox-install-exec
sandbox-install-exec: sandbox-blank
@$(MAKE) RUNJOB='void' FINALJOBS='install-exec' sandbox-beforedone;
.PHONY: sandbox-install-exec-strip
sandbox-install-exec-strip: sandbox-blank
@$(MAKE) RUNJOB='void' FINALJOBS='install-exec-strip' \
sandbox-beforedone;
.PHONY: sandbox-install-headers
sandbox-install-headers: sandbox-blank
@$(MAKE) RUNJOB='void' FINALJOBS='install-headers' sandbox-beforedone;
.PHONY: sandbox-install-man
sandbox-install-man: sandbox-blank
@$(MAKE) RUNJOB='void' FINALJOBS='install-man' sandbox-beforedone;
.PHONY: sandbox-install-data
sandbox-install-data: sandbox-blank
@$(MAKE) RUNJOB='void' FINALJOBS='install-data' sandbox-beforedone;
.PHONY: sandbox-install-html
sandbox-install-html: sandbox-blank
@$(MAKE) RUNJOB='void' FINALJOBS='install-html' sandbox-beforedone;
.PHONY: sandbox-binary-release sandbox-nearlydone
sandbox-binary-release sandbox-nearlydone: sandbox-$(INSTALLFLAVOR)
.PHONY: sandbox-alldone
sandbox-alldone: sandbox-$(INSTALLFLAVOR)
@$(MAKE) sandbox-beforedone;
.PHONY: sandbox-portable-builds
sandbox-portable-builds: sandbox-blank
@rm -rf '._excfiles_' && $(MAKE) SANDBOX='._excfiles_' RUNJOB='blank' \
FINALJOBS='install-exec-strip install-headers' sandbox-beforedone && \
$(FIND) -L '._excfiles_' -type f -exec cp -a {} '$(SANDBOX)/' \; && \
cp '$(srcdir)/COPYING' '$(SANDBOX)/COPYING' && rm -rf '._excfiles_';
.PHONY: sandbox-dist sandbox-distdir
sandbox-dist sandbox-distdir: sandbox-erase
@rm -rf '._dstfiles_' && $(MAKE) distdir='._dstfiles_' distdir && mv \
'._dstfiles_' '$(SANDBOX)';
.PHONY: sandbox-source-release
sandbox-source-release: sandbox-dist
@case ' $(DISTFLAGS) ' in *' no-symlinks '*) : ;; *) for _FILE in \
$$(cd '$(SANDBOX)' && $(FIND) -L . ! -name '.'); do ! test -L \
'$(srcdir)/'"$${_FILE}" || (rm -rf '$(SANDBOX)/'"$${_FILE}" && cp -d \
'$(srcdir)/'"$${_FILE}" '$(SANDBOX)/'"$${_FILE}"); done ;; esac;
.PHONY: sandbox-authors-copy
sandbox-authors-copy: sandbox-source-release
@(cd '$(SANDBOX)' && (rm -rf $(_bootstrapclean_dirs_); \
rm -f $(_bootstrapclean_files_)));
.PHONY: sandbox-snapshot
sandbox-snapshot:
@if test "x$$(pwd)" != "x$$(cd '$(srcdir)' && pwd)"; then { echo \
'**Error** This operation is permitted only when building from the top level'; \
echo 'directory.'; } 1>&2; exit 1; fi; rm -rf '$(SANDBOX)' && \
$(MKDIR_P) '$(SANDBOX)' && $(FIND) -L '$(srcdir)' -maxdepth 1 ! -name \
'.' ! -name '$(SANDBOX)' $$({ for _COIN in $(SNAPIGNORE); do echo "! \
-name $${_COIN}"; done; }) -exec cp -at '$(SANDBOX)' {} \; && $(MAKE) \
-C '$(SANDBOX)' BAKPATH='@PACKAGE_TARNAME@-snapshot' \
SANDBOX='volatile' oblivion-clean;
.PHONY: sandbox-git-clone
sandbox-git-clone: sandbox-erase
@git clone $(GITFLAGS) \
'@GIT_HTTP_SERVER@/@PUBLISHER_ID@/@[email protected]' '$(SANDBOX)';
# Non-phony targets with names editable on the fly (mostly `Makefile` glue, but
# nothing forbids invoking them)
# Defaults to `make volatile` (directory)
$(SANDBOX):
@$(MAKE) 'sandbox-$(RUNJOB)';
# Defaults to `make volatile.tar`
$(SANDBOX).tar: $(SANDBOX)
@rm -rf '$@' && (cd '$(SANDBOX)' && $(AMTAR) -cf '../$(@F)' *);
# Defaults to `make volatile.tar.gz` and `make volatile.tgz`
$(SANDBOX).tar.gz $(SANDBOX).tgz: $(SANDBOX)
@rm -rf '$@' && (cd '$(SANDBOX)' && $(AMTAR) -czf '../$(@F)' *);
# Defaults to `make volatile.tar.xz` and `make volatile.txz`
$(SANDBOX).tar.xz $(SANDBOX).txz: $(SANDBOX)
@rm -rf '$@' && (cd '$(SANDBOX)' && $(AMTAR) -cJf '../$(@F)' *);
# Defaults to `make volatile.zip`
$(SANDBOX).zip: $(SANDBOX)
@rm -rf '$@' && (cd '$(SANDBOX)' && zip -rqy '../$(@F)' *);
# Defaults to `make volatile.lst` (optionally supports a `LISTPREFIX` variable)
$(SANDBOX).lst: $(SANDBOX)
@rm -rf '$@' && (cd '$(SANDBOX)' && $(FIND) -L . -type f -printf \
'$(LISTPREFIX)%P\n' > '../$(@F)');
###############################################################################
## R E C I P E S P A R T I V: D I S T R I B U T I O N
###############################################################################
# Non-phony targets with names editable on the fly (mostly `Makefile` glue, but
# nothing forbids invoking them)
# Defaults to `make @PACKAGE_LOCALNAME@-@PACKAGE_VERSION@-@host@-pkg`
# (directory)
$(BINPATH):
@$(MAKE) RUNJOB='binary-release' SANDBOX='._binfiles_' \
'._binfiles_' && mv '._binfiles_' '$@';
# Defaults to `make @PACKAGE_LOCALNAME@-@PACKAGE_VERSION@-@host@-builds`
# (directory)
$(PTBPATH):
@$(MAKE) RUNJOB='portable-builds' SANDBOX='._ptbfiles_' \
'._ptbfiles_' && mv '._ptbfiles_' '$@';
# Defaults to `make @PACKAGE_TARNAME@-@PACKAGE_VERSION@-src` (directory)
$(SRCPATH):
@$(MAKE) RUNJOB='source-release' SANDBOX='._srcfiles_' \
'._srcfiles_' && mv '._srcfiles_' '$@';
# Defaults to `make @PACKAGE_TARNAME@-@PACKAGE_VERSION@-dev` (directory)
$(DEVPATH):
@$(MAKE) RUNJOB='authors-copy' SANDBOX='._devfiles_' \
'._devfiles_' && mv '._devfiles_' '$@';
$(BAKPATH):
@$(MAKE) RUNJOB='snapshot' SANDBOX='._bakfiles_' \
'._bakfiles_' && mv '._bakfiles_' '$@';
# Defaults to `make @PACKAGE_TARNAME@-@PACKAGE_VERSION@-git` (directory)
$(GITPATH):
@$(MAKE) RUNJOB='git-clone' SANDBOX='._gitfiles_' '._gitfiles_' && \
mv '._gitfiles_' '$@';
# Default to
# `make @PACKAGE_LOCALNAME@-@PACKAGE_VERSION@-@[email protected]` and
# `make @PACKAGE_LOCALNAME@-@PACKAGE_VERSION@-@host@-pkg.{...EXT...}`
$(BINPATH).lst $(BINPATH).tar $(BINPATH).tar.gz $(BINPATH).tgz $(BINPATH).tar.xz $(BINPATH).txz $(BINPATH).zip:
@_STEM="$$(basename '$(BINPATH)')" && $(MAKE) \
RUNJOB='binary-release' SANDBOX="._tmp-$${_STEM}" '._tmp-$(@F)' && \
mv '._tmp-$(@F)' '$@' && rm -rf "._tmp-$${_STEM}";
# Default to
# `make @PACKAGE_LOCALNAME@-@PACKAGE_VERSION@-@host@-builds.{...EXT...}`
$(PTBPATH).tar $(PTBPATH).tar.gz $(PTBPATH).tgz $(PTBPATH).tar.xz $(PTBPATH).txz $(PTBPATH).zip:
@_STEM="$$(basename '$(PTBPATH)')" && $(MAKE) \
RUNJOB='portable-builds' SANDBOX="._tmp-$${_STEM}" '._tmp-$(@F)' && \
mv '._tmp-$(@F)' '$@' && rm -rf "._tmp-$${_STEM}";
# Default to `make @PACKAGE_TARNAME@-@PACKAGE_VERSION@-src.{...EXT...}`
$(SRCPATH).tar $(SRCPATH).tar.gz $(SRCPATH).tgz $(SRCPATH).tar.xz $(SRCPATH).txz $(SRCPATH).zip:
@_STEM="$$(basename '$(SRCPATH)')" && $(MKDIR_P) "._tmp-$${_STEM}" && \
$(MAKE) SANDBOX="._tmp-$${_STEM}/$${_STEM}" sandbox-source-release && \
$(MAKE) RUNJOB='void' SANDBOX="._tmp-$${_STEM}" '._tmp-$(@F)' && mv \
'._tmp-$(@F)' '$@' && rm -rf "._tmp-$${_STEM}";
# Default to `make @PACKAGE_TARNAME@-@PACKAGE_VERSION@-dev.{...EXT...}`
$(DEVPATH).tar $(DEVPATH).tar.gz $(DEVPATH).tgz $(DEVPATH).tar.xz $(DEVPATH).txz $(DEVPATH).zip:
@_STEM="$$(basename '$(DEVPATH)')" && $(MKDIR_P) "._tmp-$${_STEM}" && \
$(MAKE) SANDBOX="._tmp-$${_STEM}/$${_STEM}" sandbox-authors-copy && \
$(MAKE) RUNJOB='void' SANDBOX="._tmp-$${_STEM}" '._tmp-$(@F)' && mv \
'._tmp-$(@F)' '$@' && rm -rf "._tmp-$${_STEM}";
# Default to `make @PACKAGE_TARNAME@-@PACKAGE_VERSION@-src.{...EXT...}`
$(BAKPATH).tar $(BAKPATH).tar.gz $(BAKPATH).tgz $(BAKPATH).tar.xz $(BAKPATH).txz $(BAKPATH).zip:
@_STEM="$$(basename '$(BAKPATH)')" && $(MAKE) SANDBOX="._bakfiles_" \
sandbox-snapshot && $(MKDIR_P) "._tmp-$${_STEM}" && mv '._bakfiles_' \
"._tmp-$${_STEM}/$${_STEM}" && $(MAKE) RUNJOB='void' \
SANDBOX="._tmp-$${_STEM}" '._tmp-$(@F)' && mv '._tmp-$(@F)' '$@' && \
rm -rf "._tmp-$${_STEM}";
# Default to `make @PACKAGE_TARNAME@-@PACKAGE_VERSION@-git.{...EXT...}`
$(GITPATH).tar $(GITPATH).tar.gz $(GITPATH).tgz $(GITPATH).tar.xz $(GITPATH).txz $(GITPATH).zip:
@_STEM="$$(basename '$(GITPATH)')" && $(MKDIR_P) "._tmp-$${_STEM}" && \
$(MAKE) SANDBOX="._tmp-$${_STEM}/$${_STEM}" sandbox-git-clone && \
$(MAKE) RUNJOB='void' SANDBOX="._tmp-$${_STEM}" '._tmp-$(@F)' && mv \
'._tmp-$(@F)' '$@' && rm -rf "._tmp-$${_STEM}";
# Phony targets
# File extensions for which archive targets exist (regular expression)
_re_archive_allow_ = \.tar$$\|\.tar\.gz$$\|\.tar\.xz$$\|\.tgz$$\|\.txz$$\|\.zip$$
# Build a source release that needs Autotools and a `bootstrap` script
.PHONY: authors-copy
authors-copy:
@if test 'x$(DEST)' != x; then rm -rf '$(DEST)' && $(MAKE) "$$(expr \
'DEVPATH=$(DEST)' : '\(.*\)\($(_re_archive_allow_)\)' || \
echo DEVPATH='$(DEST)')" '$(DEST)'; else \
rm -rf '$(DEVPATH).$(ZIPTYPE)' && $(MAKE) '$(DEVPATH).$(ZIPTYPE)'; fi;
# Build an installation image ready to be distributed or installed
.PHONY: binary-release
binary-release:
@if test 'x$(DEST)' != x; then rm -rf '$(DEST)' && $(MAKE) "$$(expr \
'BINPATH=$(DEST)' : '\(.*\)\($(_re_archive_allow_)\)' || \
echo BINPATH='$(DEST)')" '$(DEST)'; else \
rm -rf '$(BINPATH).$(ZIPTYPE)' && $(MAKE) '$(BINPATH).$(ZIPTYPE)'; fi;
# Clone the latest revision from the git server (requires `git`)
.PHONY: git-clone
git-clone:
@if test 'x$(DEST)' != x; then rm -rf '$(DEST)' && $(MAKE) "$$(expr \
'GITPATH=$(DEST)' : '\(.*\)\($(_re_archive_allow_)\)' || \
echo GITPATH='$(DEST)')" '$(DEST)'; else \
rm -rf '$(GITPATH).$(ZIPTYPE)' && $(MAKE) '$(GITPATH).$(ZIPTYPE)'; fi;
# Create a list of the files that will be installed by `make-install`
.PHONY: manifest
manifest:
@rm -rf '._tmp_.lst'; $(MAKE) RUNJOB='install' SANDBOX='._tmp_' \
LISTPREFIX='/' '._tmp_.lst' && (test 'x$(DEST)' != x && (rm -rf \
'$(DEST)' && mv '._tmp_.lst' '$(DEST)') || (rm -rf '$(BINPATH).lst' \
&& mv '._tmp_.lst' '$(BINPATH).lst')) && rm -rf '._tmp_';
# Build a package with only the compiled binaries and without directories
.PHONY: portable-builds
portable-builds:
@if test 'x$(DEST)' != x; then rm -rf '$(DEST)' && $(MAKE) "$$(expr \
'PTBPATH=$(DEST)' : '\(.*\)\($(_re_archive_allow_)\)' || \
echo PTBPATH='$(DEST)')" '$(DEST)'; else \
rm -rf '$(PTBPATH).$(ZIPTYPE)' && $(MAKE) '$(PTBPATH).$(ZIPTYPE)'; fi;
# Build a source release ready to be distributed
.PHONY: source-release
source-release:
@if test 'x$(DEST)' != x; then rm -rf '$(DEST)' && $(MAKE) "$$(expr \
'SRCPATH=$(DEST)' : '\(.*\)\($(_re_archive_allow_)\)' || \
echo SRCPATH='$(DEST)')" '$(DEST)'; else \
rm -rf '$(SRCPATH).$(ZIPTYPE)' && $(MAKE) '$(SRCPATH).$(ZIPTYPE)'; fi;
# Create a clean backup of **everything**, including non-distributable files
.PHONY: snapshot
snapshot:
@if test 'x$(DEST)' != x; then rm -rf '$(DEST)' && $(MAKE) "$$(expr \
'BAKPATH=$(DEST)' : '\(.*\)\($(_re_archive_allow_)\)' || \
echo BAKPATH='$(DEST)')" '$(DEST)'; else \
_STAMP="$$(date '+%Y-%m-%d-%H-%M-%S')" && rm -rf \
'$(BAKPATH)-'"$${_STAMP}"'.$(ZIPTYPE)' && $(MAKE) \
BAKPATH='$(BAKPATH)-'"$${_STAMP}" \
'$(BAKPATH)-'"$${_STAMP}"'.$(ZIPTYPE)'; fi;
## EOF