-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathGNUmakecore.in
1491 lines (1274 loc) · 49.8 KB
/
GNUmakecore.in
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
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# GNUmakecore -*- makefile -*-
# Notes are at the end of this file, see ``Useful Variables'' for a template
#
GENERATOR = "@configure_input@"
THISFILE = "GNUmakecore"
MAKEFILE = "GNUmakefile"
AUTHOR = "C. Alex. North-Keys"
GROUP = "Group Talisman"
#
VERSION = Gnu.30 2010-11-11 14:08:12 CST (Nov Thu) add CCMODEFLAGS
#
# Make spawns depth-first traversal throughout the subtree.
# During this recursion, the last thing done in each directory node is to
# carry out whatever action on the files was requested.
#
# The variable INC and LIB may be set from the command line to specify
# extra CPPFLAGS for includes (INC), and LDFLAGS for -L options (LIB).
#------------------------------------------------------------- Options
MAKEFLAGS += --no-print-directory
SHELL = /bin/sh
# INDENT_FILTER = sed 's@.*@ &@g' 1>&2
# The perl version disables buffering
INDENT_FILTER = perl -e '$$| = 1; while(<STDIN>){ s/^/ /; print; }' 1>&2
# Note that targets that build may require the library and config.h,
# but targets which remove things generally only require the GNUmakecore file.
# The target "destdirs" also only requires GNUmakecore.
# Reserved target names
NONRECURSORS_BUILDERS = \
paper doc shar
# Obsolete commands
NONRECURSORS_OBSOLETE = \
Makefile Makefiles install.man includes lint lint1
NONRECURSORS_BUILDLESS = \
destdirs \
help status tellvers telldest tellmode tellvars \
kempt_aux tidy_aux clean_aux pure_aux pristine_aux scoured_aux \
mostlyclean distclean maintainer-clean installdirs
NONRECURSORS = $(NONRECURSORS_OBSOLETE) $(NONRECURSORS_BUILDERS) $(NONRECURSORS_BUILDLESS)
# "all" must be the first target in the RECURSORS_BUILDERS_WITH_CCF list
# "WITH_CCF" refers to "With C Compiler Flags"
RECURSORS_BUILDERS_WITH_CCF = \
all \
archive shlib objects assembly preprocess binge \
normal paranoid neurotic fascist profile debug optimize optimise \
install install-strip
# Depend seems a WITH_CCF candidate, but the current flags make no difference.
RECURSORS_BUILDERS_NO_CCF = \
strip \
info tags \
dist \
depend \
cvscommit cvsupdate cvsdiff cvsimport
RECURSORS_BUILDERS = $(RECURSORS_BUILDERS_WITH_CCF) $(RECURSORS_BUILDERS_NO_CCF)
# targets which create nothing and may actually destroy things
RECURSORS_BUILDLESS = \
traverse \
du \
undist \
undepend \
uninstall \
kempt tidy clean pure pristine scoured
RECURSORS = $(RECURSORS_BUILDERS) $(RECURSORS_BUILDLESS)
BUILDERS = $(NONRECURSORS_BUILDERS) $(RECURSORS_BUILDERS)
BUILDLESS = $(NONRECURSORS_BUILDLESS) $(RECURSORS_BUILDLESS)
.PHONY: $(NONRECURSORS) $(RECURSORS)
#------------------------------------------------------------- Variables
MEMCONV = $(addsuffix .X,$(basename $(MEMSRCS)))
MEMBERS = $(MEMCONV:.X=.o)
MEMDEPS = $(addprefix $(DEPSDIR)/,$(MEMCONV:.X=.d))
MEMARCH = $(patsubst %,$(ARCHIVE)(%),$(MEMBERS))
ALLSRCS = $(SRCS) $(MEMSRCS) $(HEADERS)
DEPSDIR = .depend
ifndef ARCH
export ARCH := $(shell echo `uname -s`-`uname -p`-`uname -r | awk -F. '{print $1"."$2}'` | tr '[A-Z]' '[a-z]' || echo unknown)
endif
# Object, Assembly, Preprocessed
# addsuffix .X,$(basename $(SRCS)))
CONV = $(filter %.c,$(SRCS))
CONVXX = $(filter %.cc,$(SRCS))
DEPS = $(addprefix $(DEPSDIR)/,$(CONV:.c=.d) $(CONVXX:.cc=.d)) $(MEMDEPS)
OBJS = $(CONV:.c=.o) $(CONVXX:.cc=.oo)
PPRS = $(CONV:.c=.i) $(CONVXX:.cc=.ii)
ASMS = $(CONV:.c=.s) $(CONVXX:.cc=.ss)
# The TESTS variable should include all (valid) .t modules tests, which
# will be tested automatically.
# TESTS = $(addsuffix .t,$(basename $(SRCS) $(MEMSRCS)))
#------------------------------------------------------------- Compile How?
# The following flags are specific to GCC 2.3.3+
# -finline-functions # should no longer be necessary
# -fkeep-inline-functions # obsolete
# -funroll-loops # still had a bug in 2.2.2
# -O includes -fthread-jumps and -fdelayed-branch
# -O2 includes all -f(flags) except for:
# -funroll-loops -funroll-all-loops -fomit-frame-pointer
# -O3 includes loop unrolling
# NOTE: GNU c++ example compile times by -O options:
# -O0: 3.4 s (same as no -O option)
# -O1: 13.8 s (same as just -O)
# -O2: 17.0 s
# -O3: 78.0 s
# -Wfloat-equal # warn in circumstances when nexttoward() might be advisable.
# # oh great, it warns when it shouldn't too.
CCParanoidWarnings = -W -Wall \
-Wno-empty-body -Wno-implicit -Wno-unused -Wno-parentheses -Wno-comment \
-Wpointer-arith
#? -Wundef # bitch about undefined identifiers in #if's
# -Wshadow # bitch about shadowed locals (actually, we -like- shadowing)
# -Wbad-function-cast # bitch (in C) about questionable casts of func returns.
# -Wcast-qual -Wcast-align # bitch about various cast weirdness.
# -Wnested-externs # bitch about extern's in functions.
# -Wredundant-decls # bitch about redundance in same scope.
# -Wstrict-prototypes # bitch about void foo(), with missing void.
# -Wmissing-prototype # bitch (in C) on unprotyped global functions
# -Wmissing-declaration # bitch (in C) on global functions w/o prior decls.
# -Waggregate-return # bitch on returns of struct, union or array.
# -Wconversion # would bitch about explicit conversions.
# -Wwrite-strings # causes terror on: const char *foo[] = { "hi", NULL }.
# -Wunused # this always bitches about the Version-like constants.
# -Wcomment # /* /* */ is used all too commonly.
# -Wimplicit # this just makes coping with incomplete headers a pain.
# -Wparentheses # bitches uselessly about if(a = 23) style logicals.
CCNeuroticWarnings = \
-Wcast-align -Winline -Wstrict-prototypes
# -Wredundant-decls # bitch about redundant identical prototypes
CCFascistWarnings = -Werror
# modes: (normal) paranoid neurotic fascist optimize profile debug
# add -O to paranoid/neurotic/fascist to get full warnings.
CCAny = -pipe
CCNormal = $(CCAny) -g
CCParanoid = $(CCNormal) -O $(CCParanoidWarnings)
CCNeurotic = $(CCParanoid) $(CCNeuroticWarnings)
CCFascist = $(CCNeurotic) $(CCFascistWarnings)
CCDebug = $(CCNeurotic) -O0 -DDEBUG
CCProfile = $(CCOptimize) -pg
# note: O2 and above need -fno-delete-null-pointer-checks
CCOptimize = $(CCAny) -O3 -fno-delete-null-pointer-checks
# note: one author has complained that GCC/LD like to strip
# symbols by default and drop frame pointers. The latter
# can be prevented with -fno-omit-frame-pointer, to ease
# stack profiling.
#------------------------------------------------------------- Variables
# Use "./configure --prefix=" to cleanly set up for / as the prefix
# Networked Examples: netwide system GNU pod, a user's home pod
# ./configure --prefix=/pod/gnu --exec-prefix='/pod/gnu/abi/${ARCH}'
# ./configure --prefix='${HOME}'/pod --exec-prefix='${HOME}'/pod/abi/'${ARCH}'
# PROBLEM (XXX)
# It would be better to get ${HOME} or "~" passed all the way in as a literal
# with the following assumptions applying:
#
# 1) The shell will expand it in all necessary commands (i.e. BASH)
# - if ${HOME} can be passed all the way in, than Bourne sh is enough
# 2) Programs will call a function to do ~ expansion on directories
# The more standard one - all the host_prefix quirks happen for non-null prefix
prefix := @prefix@
exec_prefix := @exec_prefix@
datadir := @datadir@# this is only here to support $lispdir
# part of this build method, arch-descriptions go here for now, see CONFIG_H
DESTABI = $(if $(exec_prefix),$(exec_prefix),/etc/abi)
# - read only architecture-specific
DESTBIN = @bindir@# /usr/local/[abi/]bin
DESTSBIN = @sbindir@# /usr/local/[abi/]sbin
DESTLIBEXEC = @libexecdir@# /usr/local/[abi/]libexec
DESTLIB = @libdir@# /usr/local/[abi/]lib
# - read only host-specific
# SHARED FILESYSTEMS
# The idea of /pod/gnu/host/$hostname/etc and /pod/gnu/host/$hostname/var
# was explored, but it's unrealistic to assume that an app will be installed
# seperately for each host using the shared filesystem - new machines can
# be expected to appear later, at which time they'll have no config.
# Apps with host[name]-specific issues can, of course, create directories
# themselves like /pod/gnu/etc/<app>/$hostname or whatever.
DESTCONFSYS = @sysconfdir@# /usr/local/etc
DESTSTATE = @localstatedir@# /usr/local/var
# - read/write shared
DESTSTATESH = @sharedstatedir@# /usr/local/com
# - read only shared
DESTDATA = @datadir@# /usr/local/share (lispdir's under here)
DESTLISP = @lispdir@# /usr/local/share/emacs/site-lisp
DESTINC = @includedir@# /usr/local/include
DESTBINSH = $(prefix)/bin# /usr/local/bin
# - read only shared - these three are not part of the GNU variable set
DESTCONF = $(prefix)/etc# /usr/local/etc
DESTDIST = $(prefix)/pub# /usr/local/pub
DESTDOC = $(prefix)/doc# /usr/local/doc
# - read only shared (documentation)
DESTINFO = @infodir@# /usr/local/info
DESTMAN = @mandir@# /usr/local/man
DESTMAN1 = $(DESTMAN)/man1# /usr/local/man/man1
DESTMAN2 = $(DESTMAN)/man2# /usr/local/man/man2
DESTMAN3 = $(DESTMAN)/man3# /usr/local/man/man3
DESTMAN4 = $(DESTMAN)/man4# /usr/local/man/man4
DESTMAN5 = $(DESTMAN)/man5# /usr/local/man/man5
DESTMAN6 = $(DESTMAN)/man6# /usr/local/man/man6
DESTMAN7 = $(DESTMAN)/man7# /usr/local/man/man7
DESTMAN8 = $(DESTMAN)/man8# /usr/local/man/man8
DESTMAN9 = $(DESTMAN)/man9# /usr/local/man/man9
# These have system-specific details, like whether compressed or not, etc.
# It is highly annoying the extensions share no variables with the directories.
MAN1EXT = .1
MAN2EXT = .2
MAN3EXT = .3
MAN4EXT = .4
MAN5EXT = .5
MAN6EXT = .6
MAN7EXT = .7
MAN8EXT = .8
MAN9EXT = .9
# Note: we'd like to step through each of these and compress runs of slashes.
DESTVARS = \
DESTABI \
DESTBIN DESTSBIN DESTLIBEXEC DESTLIB \
DESTCONFSYS DESTSTATE DESTSTATESH \
DESTBINSH DESTDATA DESTLISP DESTINC \
DESTCONF DESTDIST DESTDOC \
DESTINFO \
DESTMAN DESTMAN1 DESTMAN2 DESTMAN3 DESTMAN4 \
DESTMAN5 DESTMAN6 DESTMAN7 DESTMAN8 DESTMAN9
DESTDIRS = $(foreach var,$(DESTVARS),$($(var)))
# additional include and library directories to be added for cpp and ld
# CPPINCPATH = @CPPINCPATH@ # -idirafter <dir> -or- -I<dir>
# LDLIBPATH = @LDLIBPATH@ # -L<dir>
# This allows the config.h in the current directory to be used if an installed
# one isn't present, pursuant to making self-complete tar distributions.
CONFIG_H = $(firstword $(wildcard $(DESTABI)/config.h) config.h)
# In special circumstances, the locations of included headers may need to
# be set manually (such as when using a separate library). To avoid
# mangling the CPPFLAGS variable from the command line, the INC variable is
# exposed here:
INC =
CPPFLAGS = $(INC) -include $(CONFIG_H)
CC = @CC@
CXX = @CXX@
CCMODEFLAGS = $(CCNormal)
# Toss what used to be a non-complaining C++ options
CXXFLAGS = $(patsubst -Wno-implicit,,$(patsubst -Wstrict-prototypes,,$(CCMODEFLAGS)))
COMPILE.c = $(CC) $(CPPFLAGS) $(CCMODEFLAGS) $(CCFLAGS)
COMPILE.cxx = $(CXX) $(CPPFLAGS) $(CXXFLAGS)
CCVER_OPTS = -v
DEPENDLINE = DO NOT DELETE THIS LINE -- make depend depends on it.
DEPENDFLAGS = -MM
DEPENDFILE = .depend
# In special circumstances, -L options required for various libraries may
# need to be set manually (such as when using a separate library). To avoid
# mangling the LDFLAGS variable from the command line, the LIB variable is
# exposed here. See SHLIB_LD in the SHLIB section for additional quirks.
LIB =
LDFLAGS = $(LIB) @LDFLAGS@
LD = $(CC)
LD_REAL = @LD@
LDVER_OPTS = -v
LDLIBS = $(patsubst lib%.a,-l%,$(ARCHIVE)) $(LIBSUN)
LINK.c = $(LD) $(CPPFLAGS) $(CCMODEFLAGS) $(CCFLAGS) $(LDFLAGS)
LINK.cxx = $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
# an interesting trick, put the associated -L option before the -l options
LIBTALISMAN = -ltalisman
LIBTALISMAN++ = -ltalisman++
LIBC = -lc
LIBM = @LIBM@ # -lm
LIBMALLOC = @LIBMALLOC@ # -lmalloc
LIBPTHREAD = @LIBPTHREAD@ # -lpthread
LIBIMAGESGI = @LIBIMAGESGI@ # -limage
LIBIMLIB = @LIBIMLIB@ # -limlib
LIBPNG = @LIBPNG@ # -lpng
LIBSOCKET = @LIBSOCKET@ # -lsocket for Suns and some others
LIBSUN = @LIBSUN@ # -lsun for non-Suns :-)
LIBRPCSVC = @LIBRPCSVC@ # -lrpcsvc
LIBCRACK = @LIBCRACK@ # -lcrack
LIBCRYPT = @LIBCRYPT@ # -lcrypt
LEXLIB = @LEXLIB@ # -ll or -lfl for flex
# Terminal support
LIBCURSES = @LIBCURSES@ # -lcurses [-ltermcap]
LIBTERMCAP = @LIBTERMCAP@ # -ltermcap
# LIBTERMINFO?
# XCB
LIBXCB_CORE = @LIBXCB_CORE@ # -lxcb
LIBXCB_RENDER = @LIBXCB_RENDER@ # -lxcb-render
LIBXCB_GLX = @LIBXCB_GLX@ # -lxcb-glx
LIBXCB = @LIBXCB@ # -lxcb-glx -lxcb-render -lxcb
LIBX11_XCB = @LIBX11_XCB@ # -lX11-xcb
# Xlibs: X11 Xau Xaw Xext Xinput Xmu Xol Xt
# Xm Xirisw Xt Xmu gl Xi Xext X11 -- # SGI order (but no more old GL, ever)
# -lGLw -lGLU -lGL -lXm -lXaw -lXmu -lXt -lXext -lX11 -limage
# Collection: $(LIBX) - reason: convenience
LIBX11 = @LIBX11@ # -lX11
LIBXEXT = @LIBXEXT@ # -lXext
LIBXT = @LIBXT@ # -lXt
LIBSM = @LIBSM@ # -lSM
LIBICE = @LIBICE@ # -lICE
LIBXMU = @LIBXMU@ # -lXmu
LIBX = @LIBX@ # -lXmu -lICE -lSM -lXt -lXext -lX11
LIBXI = @LIBXI@ # -lXi
LIBXAU = @LIBXAU@ # -lXau
LIBXAW = @LIBXAW@ # -lXaw
LIBXM = @LIBXM@ # -lXm
LIBXTST = @LIBXTST@ # -lXtst
# Collection: $(LIBGLUT) - reason: support libs may differ by architecture
LIBIRISGL = @LIBIRISGL@ # -lgl (or perhaps -lgl_s ?)
LIBGLTK = @LIBGLTK@ # -lgltk
LIBGLW = @LIBGLW@ # -lGLw
LIBGLU = @LIBGLU@ # -lGLU -lGL
LIBGL = @LIBGL@ # -lGL
LIBGLUT = @LIBGLUT@ # -lglut -Xi -lGLU -lGL
LIBS = @LIBS@
YACC = @YACC@ # bison -y
XMKMF = @XMKMF@
ARFLAGS = cuvs
RANLIB = @RANLIB@
COMPILE.snf = @BDFTOSNF@
COMPILE.pcf = @BDFTOPCF@
COMPILE.fb = @CONVERTFONT@
COMPILE.tex = @LATEX@
TEXI2DVI = @TEXI2DVI@
MAKEINFO = @MAKEINFO@
# Java support
JAVAC = @JAVAC@
JAVA = @JAVA@
JAVAFLAGS =
COMPILE.java = $(JAVAC) $(JAVAFLAGS)
# the following compress commands should work as filters
COMPRESS = @COMPRESS@
UNCOMPRESS = @UNCOMPRESS@
COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
TAR = @TAR@
AWK = @AWK@
RM = rm -f
RMDIR = rmdir
MV = mv -f
MVDIR = mv -f
CP = cp
LN = ln
CPDIR = cp -r
STRIP = strip
CO = co
CI = ci
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_PROGRAM_STRIPPED = $(INSTALL_PROGRAM) -s
INSTALL_SCRIPT = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_MAN = $(INSTALL) -m 644
INSTALL_INFO = @INSTALL_INFO@
CHMOD = chmod
CHOWN = chown
CHGRP = chgrp
TAPE = /dev/rst0
DISK = /dev/rfd0
#------------------------------------------------------------- Rules
#
# SUBDIRS_BUILDABLE = \
# $(filter-out RCS/ CVS/ Hold/ , \
# $(dir $(foreach dir,$(subst /.,,$(wildcard */.)),\
# $(firstword $(wildcard $(dir)/GNUmakefile) \
# $(wildcard $(dir)/Makefile) \
# $(wildcard $(dir)/makefile) \
# $(wildcard $(dir)/configure) \
# $(wildcard $(dir)/configure.ac) \
# $(wildcard $(dir)/Imakefile) \
# ))))
SUBDIRS_BUILDABLE := \
$(filter-out RCS CVS Hold , \
$(dir $(foreach dir,\
$(subst ./,,\
$(shell find . -name '.*' -o -type d -prune -print)),\
$(firstword $(wildcard $(dir)/GNUmakefile) \
$(wildcard $(dir)/Makefile) \
$(wildcard $(dir)/makefile) \
$(wildcard $(dir)/configure) \
$(wildcard $(dir)/configure.ac) \
$(wildcard $(dir)/Imakefile) \
))))
# C Compiler flag settings for members of RECURSORS_BUILDERS_WITH_CCF
normal : CCMODEFLAGS = $(CCNormal)
paranoid : CCMODEFLAGS = $(CCParanoid)
neurotic : CCMODEFLAGS = $(CCNeurotic)
fascist : CCMODEFLAGS = $(CCFascist)
profile : CCMODEFLAGS = $(CCProfile)
debug : CCMODEFLAGS = $(CCDebug)
optimize : CCMODEFLAGS = $(CCOptimize)
optimise : CCMODEFLAGS = $(CCOptimize)
all archive shlib objects assembly preprocess binge : CCMODEFLAGS = $(CCParanoid)
install install-strip : CCMODEFLAGS = $(CCOptimize)
# Install settings
install-strip : INSTALL_PROGRAM += -s
all :: sprawl $(ARCHIVE) $(PROGS) $(PROG)
$(RECURSORS_BUILDERS_NO_CCF) $(RECURSORS_BUILDLESS) :: sprawl
normal paranoid neurotic fascist profile debug optimize optimise :: \
sprawl $(ARCHIVE) $(PROGS) $(PROG)
archive :: sprawl $(ARCHIVE)
shlib :: sprawl $(SHLIB)
objects :: sprawl $(OBJS)
assembly :: sprawl $(ASMS)
preprocess :: sprawl $(PPRS)
binge :: sprawl $(PPRS) $(ASMS) $(OBJS) $(PROG) $(PROGS) $(ARCHIVE)
install install-strip :: sprawl pre-install normal-install post-install
PWD = $(patsubst $(HOME)%,~%,$(shell pwd | sed 's|^/[.]automount||;s|^/tmp_mnt/||'))
sprawl : sprawl-pre sprawl-normal sprawl-post
go : go-pre go-normal go-post
sprawl-pre:
# @echo '['"$(MAKELEVEL) $(MAKECMDGOALS)/$@ $(PWD)"' {$(CCMODEFLAGS)|$(TARGETS)}]'
@echo '['"$(MAKELEVEL) $(MAKECMDGOALS) $(PWD)"' ]'
sprawl-normal : $(addsuffix .recurse, $(SUBDIRS_BUILDABLE))
# @echo '['"$(MAKELEVEL)2 $(MAKECMDGOALS)/$@ $(PWD)"' {$(CCMODEFLAGS)|$(TARGETS)}]'
# @echo 'dependencies: $^'
sprawl-post:
# @echo '['"$(MAKELEVEL)3 $(MAKECMDGOALS)/$@ $(PWD)"' {$(CCMODEFLAGS)|$(TARGETS)}]'
go-pre: sprawl
# @echo '['"$(MAKELEVEL)4 $(MAKECMDGOALS)/$@ $(PWD)"' {$(CCMODEFLAGS)|$(TARGETS)}]'
go-normal : $(TARGETS)
# @echo '['"$(MAKELEVEL)5 $(MAKECMDGOALS)/$@ $(PWD)"' {$(CCMODEFLAGS)|$(TARGETS)}]'
# @echo '['"$(MAKELEVEL) $(TARGETS) | $^ $(PWD)"']'
# @if [ -n "$(strip $(TARGETS))" ] ; then $(MAKE) CCMODEFLAGS='$(CCMODEFLAGS)' $(TARGETS) | $(INDENT_FILTER) ; else : ; fi
go-post:
# @echo '['"$(MAKELEVEL)6 $(MAKECMDGOALS)/$@ $(PWD)"' {$(CCMODEFLAGS)|$(TARGETS)}]'
%.recurse : %/GNUmakefile
@( if cd $(dir $@) >/dev/null ; then \
$(MAKE) $(MAKECMDGOALS) 2>&1 | $(INDENT_FILTER) ; \
else echo could not cd to $(dir $@) ; \
fi )
%.recurse : %/Makefile
@( if cd $(dir $@) >/dev/null ; then \
$(MAKE) $(MAKECMDGOALS) 2>&1 | $(INDENT_FILTER) ; \
else echo could not cd to $(dir $@) ; \
fi )
%/configure : %/configure.ac
( cd $(dir $@) && autoconf; }
%/GNUmakefile : %/GNUmakefile.in %/configure
( cd $(dir $@) && \
./configure --config-cache \
--prefix='$$$${HOME}'/pod \
--exec-prefix='$$$${HOME}'/pod/abi/'$$$${ARCH}' )
%/GNUmakefile : %/Imakefile
if [ -z $(XMKMF) ] ; then \
( if cd $(dir $@) ; then \
$(XMKMF) && $(MAKE) Makefiles ; \
fi ; ) ; \
else '[XMKMF unavailable]' ;\
fi
#===================================================== end of TRAVERSAL
# DEST*/%: % -- added Sun Jul 26 14:25:06 GMT 1992
# presumption: modes propagated to targets.
# 2003-12-17 13:46:15 CST (Dec Wed) first use of define/endef sequences
# Note: in make 3.79, control of output, @, in define/endef is unreliable
define ensure_directory_exists
@dirck () { \
if [ ! -d $$1 ] ; then \
dirck $${1%/*} ; \
mkdir $$1 && echo '[created' $$1 ']' ; \
fi ; \
}; \
dir=$@ ; dirck $${dir%/*}
endef
define ensure_directory_exists_and_clear_target
$(ensure_directory_exists)
@if [ -r $@ ]; then $(RM) $@ ; fi
endef
# - read only architecture-specific
$(DESTBIN)/% : %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_PROGRAM) $< $@
$(DESTSBIN)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_PROGRAM) $< $@
$(DESTLIBEXEC)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_PROGRAM) $< $@
$(DESTLIB)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
@case $< in lib*.a) $(RANLIB) $@ ;; esac
# - read only host-specific
$(DESTCONFSYS)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
$(DESTSTATE)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
# - read/write shared
$(DESTSTATESH)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
# - read only shared
$(DESTDATA)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
$(DESTLISP)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
$(DESTINC)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
$(DESTBINSH)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_SCRIPT) $< $@
# - read only shared - these three are not part of the GNU variable set
$(DESTCONF)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
$(DESTDIST)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
$(DESTDOC)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
# - read only shared (documentation)
$(DESTINFO)/%: %
$(ensure_directory_exists_and_clear_target)
$(INSTALL_DATA) $< $@
ifeq (1,1)
# NOTE: Designed for a target like: $(DESTMAN)/man1/cmd.1
# which will look for ./man1/cmd.1 automatically as a source
# One -could- use $(DESTMAN1)/cmd.$(MAN1EXT), if you generated
# cmd's manual at ./man1/cmd.$(MAN1EXT), but notice how some
# hacking will be required to extract the "man1" from $(DESTMAN1)
# before doing a nontrivial patsubst to get its name under .
$(DESTMAN)/%: %
$(ensure_directory_exists)
@dir=$(patsubst %/,%,$(dir $@)); if [ ! -d $$dir ]; then mkdir $$dir; fi
@if [ -r $@ ]; then $(RM) $@ ; fi
$(INSTALL_DATA) $< $@
else
# An alternative is to put the manpage source in with the code.
# We want to assume that manual pages are shareable, and host-
# and OS-independent, and that the build infrastructure will
# transparently arrange for compression if needed
$(DESTMAN1)/%.$(MAN1EXT): %.man
@dir=$(patsubst %/,%,$(dir $@)); if [ ! -d $$dir ]; then mkdir $$dir; fi
@if [ -r $@ ]; then $(RM) $@ ; fi
@: do OS conversions, etc. here.
$(INSTALL_DATA) $< $@
#... put the other 7 here
# generate the page to install to include the system details of
# compressed or not based on (for example) $(MAN1EXT), then
# use the rule of $(DESTMAN1)/%.$(MAN1EXT): %.$(MAN1EXT)
# for a target of $(DESTMAN1)/cmd.$(MAN1EXT)
# This would apparently require an explicit rule for each manual section.
# The developer should NOT have to write rules to handle this OS dependency.
#
$(DESTMAN1)/%.$(MAN1EXT): %.$(MAN1EXT)
@dir=$(patsubst %/,%,$(dir $@)); if [ ! -d $$dir ]; then mkdir $$dir; fi
@if [ -r $@ ]; then $(RM) $@ ; fi
$(INSTALL_DATA) $< $@
#... put the other 7 here
endif
#------------------------------------------------------------- Rules
OUTPUT_OPTION = -o $@
# The following could be simply: mkdirhier $*, or mkdir -p $*
# This rule is masked by the $(DEST___)/%:% rules.
%/. ::
@dirck () { \
if [ ! -d $$1 ] ; then \
if dirck `dirname $$1`; then \
if mkdir $$1; then \
echo "[created $$1]"; \
fi; \
fi; \
fi; \
}; \
dirck $(patsubst %/,%,$*)
# $(LEX.l) $< > $*.l.c
# $(COMPILE.c) -c -o $@ $*.l.c
# [ -r $*.l.c ] && $(RM) $*.l.c
%.o : %.l
$(LEX.l) $< | $(COMPILE.c) -c -o $@ -x c - $(LEXLIB)
# $(LEX.l) $< > $*.l.c
# $(COMPILE.c) -o $@ $*.l.c $(LEXLIB)
# [ -r $*.l.c ] && $(RM) $*.l.c
% : %.l
$(LEX.l) $< | $(COMPILE.c) -o $@ -x c - $(LEXLIB)
# TeX/LaTeX notes: http://mintaka.sdsu.edu/GF/bibliog/latex/LaTeXtoPDF.html
%.ps : %.dvi
dvi2ps -- < $< > $@
%.dvi : %.tex
$(COMPILE.tex) $< 2>&1 | egrep -v '(10000|^$$)' ;
%.pdf : %.ps
ps2pdf $< > $@
%.pdf : %.tex
pdflatex $< > $@
%.dvi : %.texi
$(TEXI2DVI) $<
%.pcf : %.bdf
$(COMPILE.pcf) -o $@ $<
%.snf : %.bdf
$(COMPILE.snf) < $< > $@
%.fb : %.bdf
$(COMPILE.fb) -o $* $<
%.info : %.texi
$(MAKEINFO) $<
%.o : %.c
$(COMPILE.c) -c $(OUTPUT_OPTION) $<
%.s : %.c
$(COMPILE.c) -S $(OUTPUT_OPTION) $<
%.i : %.c
$(COMPILE.c) -E $(OUTPUT_OPTION) $<
%.o : %.s
$(COMPILE.c) -c $(OUTPUT_OPTION) $<
%.a : %.o
$(AR) $(ARFLAGS)r $@ $^
%.so : %.a
$(LD_SHLIB) -shared --whole-archive -o $@ $^
#----------------------------------------------------- Program {
# if any of the suffixes is ".oo", use $(LINK.cxx)
ifneq ($(strip $(OBJS)),)
LINKPROG = $(if $(filter %.oo, $(OBJS)), $(LINK.cxx), $(LINK.c))
$(PROG): $(OBJS) $(ARCHIVE)
$(LINKPROG) $(OUTPUT_OPTION) $(OBJS) $(LDLIBS)
else
LINKPROG = $(if $(filter %.cc, $(OBJS)), $(LINK.cxx), $(LINK.c))
$(PROG): $(SRCS)
endif
#------------------------------------------------------------- }
% : %.s $(ARCHIVE)
$(COMPILE.c) $(OUTPUT_OPTION) $^ $(LDLIBS)
% : %.o $(ARCHIVE)
$(LINK.c) $(OUTPUT_OPTION) $^ $(LDLIBS)
% : %.c $(ARCHIVE)
$(COMPILE.c) $(LDFLAGS) $(OUTPUT_OPTION) $^ $(LDLIBS)
%.class : %.java
$(COMPILE.java) $^
%.t : %.c $(ARCHIVE)
$(COMPILE.c) -O $(CCParanoid) $(LDFLAGS) -DTEST $(OUTPUT_OPTION) $^ $(LDLIBS)
# | sed '\''s@^\(.*\)[.]o *: *@\1.d &@'\'' > $@'
$(DEPSDIR)/%.d : %.c
@echo 'Depending (C):' $< '->' $@ ; \
[ -d $(DEPSDIR) ] || mkdir $(DEPSDIR) ; \
$(SHELL) -ec '$(CC) $(DEPENDFLAGS) $(CPPFLAGS) $< \
| sed '\''s@^\(.*\)[.]o *: *@\1.d $(ARCHIVE)(\1.o) & @'\'' > $@'
# I miss the .c++ and .h++ of the early 1990s.
ifndef CXXEXT_C
CXXEXT_C = cc
endif
ifndef CXXEXT_H
CXXEXT_H = hh
endif
%.$(CXXEXT_C) :
#%.o : %.$(CXXEXT_C)
# $(COMPILE.cxx) -c $(OUTPUT_OPTION) $<
%.oo : %.$(CXXEXT_C)
$(COMPILE.cxx) -c $(OUTPUT_OPTION) $<
%.ss : %.$(CXXEXT_C)
$(COMPILE.cxx) -S $(OUTPUT_OPTION) $<
%.ii : %.$(CXXEXT_C)
$(COMPILE.cxx) -E $(OUTPUT_OPTION) $<
% : %.$(CXXEXT_C)
$(COMPILE.cxx) $(LDFLAGS) $(OUTPUT_OPTION) $^ $(LDLIBS)
%.t : %.$(CXXEXT_C) $(ARCHIVE)
$(COMPILE.cxx) -O $(CCParanoid) $(LDFLAGS) -DTEST $(OUTPUT_OPTION) $^ $(LDLIBS)
# | sed '\''s@^\(.*\)[.]o *: *@\1.d &@'\'' > $@'
$(DEPSDIR)/%.d : %.$(CXXEXT_C)
@echo 'Depending (C++):' $< '->' $@ ; \
[ -d $(DEPSDIR) ] || mkdir $(DEPSDIR) ; \
$(SHELL) -ec '$(CC) $(DEPENDFLAGS) $(CPPFLAGS) $< \
| sed '\''s@^\(.*\)[.]o *: *@\1.d $(ARCHIVE)(\1.o) & @'\'' > $@'
#--------------------------------------------------------- Intermediates
# X (in)compatibility - obsolete target
lint lint1::
@echo $(THISFILE): requested target \"$@\" not supported.
#------------------------------------------------------------ Archives
CCSHLIB_FLAGS = -DARCHIVE -fPIC
(%.o): %.$(CXXEXT_C)
$(COMPILE.cxx) $(CCSHLIB_FLAGS) -c -o $% $<
$(AR) $(ARFLAGS)r $@ $%
@$(RM) $%
(%.o): %.c
$(COMPILE.c) $(CCSHLIB_FLAGS) -c -o $% $<
$(AR) $(ARFLAGS)r $@ $%
@$(RM) $%
$(ARCHIVE): $(MEMARCH)
@$(RANLIB) $(ARCHIVE)
archive :: $(ARCHIVE)
# a problem: .so archives need different flags (and not gcc?)
# may need to create a different extension.
# more probs: on INSTALL, ".so", ".so.1" (for example) omitted for ".so.1.1"
# compilation: (old -pic) new: -fPIC
# link-editor: -assert pure-text
# HAH! we build them straight from the .a
# $(LD) -o $@ -assert pure-text
# Variables
# SHLIB the simple name of the shlib, with major and version numbers
# SHLIB_LD the linker to use, probably $(CC) or $(CXX) for now
# using $(LD_REAL) used to work, but doesn't anymore (~2006/7)
ifdef SHLIB
# SHLIB = library.so.1.0
SHLIB_LD = $(CC)
SHLIB_WITH_MAJOR = $(basename $(SHLIB))
SHLIB_NO_VERSION = $(basename $(basename $(SHLIB)))
SHLIB_TOKENS = $(subst ., ,$(SHLIB))
SHLIB_TOKENS2 = $(subst ., ,$(SHLIB_WITH_MAJOR))
SHLIB_MAJOR = $(word $(words $(SHLIB_TOKENS)),$(SHLIB_TOKENS))
SHLIB_MINOR = $(word $(words $(SHLIB_TOKENS2)),$(SHLIB_TOKENS2))
# Note: SHLIB_LIBS critical to allow linking against $(SHLIB)'s dependencies
# $(LD_SHLIB) -fPIC --shared --soname $(SHLIB_WITH_MAJOR) -o $(SHLIB) \
# --whole-archive $(ARCHIVE) \
# --no-whole-archive $(SHLIB_LIBS) ; \
# $(CC) -Wl,--shared -Wl,--soname,$(SHLIB_WITH_MAJOR) -o $(SHLIB) \
# -Wl,--whole-archive $(ARCHIVE) \
# -Wl,--no-whole-archive $(SHLIB_LIBS) ; \
$(SHLIB) :: $(ARCHIVE)
set -x ; \
$(SHLIB_LD) -fPIC --shared \
-Wl,-soname,$(SHLIB_WITH_MAJOR) -o $(SHLIB) \
-Wl,-whole-archive $(ARCHIVE) \
-Wl,-no-whole-archive $(SHLIB_LIBS) ; \
[ -r $(SHLIB_WITH_MAJOR) ] || ln -s $(SHLIB) $(SHLIB_WITH_MAJOR) ; \
[ -r $(SHLIB_NO_VERSION) ] || ln -s $(SHLIB) $(SHLIB_NO_VERSION) ; \
: check ldconfig
shlib :: $(SHLIB)
endif # SHLIB
#FAILED: $(CC) -fPIC -Wl,-shared -Wl,-whole-archive -Wl,-soname,$(SHLIB_WITH_MAJOR) ; -Wl,-no-whole-archive \
#HELPS -fPIC helps with finding references to symbols in library
# $(LD_SHLIB) -pic -shared -soname $(SHLIB_WITH_MAJOR) -o $(SHLIB) -whole-archive $(ARCHIVE) -no-whole-archive ; \
# case "`gcc -dumpversion`" in \
# 4.*) \
# $(CC) -fPIC -Wl,-shared -Wl,-whole-archive -Wl,-soname,$(SHLIB_WITH_MAJOR) \
# -o $(SHLIB) $(ARCHIVE) -Wl,-no-whole-archive;; \
# *) \
# $(LD_SHLIB) -shared --whole-archive -soname $(SHLIB_WITH_MAJOR) \
# -o $(SHLIB) $(ARCHIVE) ;; \
# esac ; \
#
#-------------------------------------------------------------------CVS
cvscommit ::
cvs commit .
cvsupdate ::
cvs update .
cvsdiff ::
cvs diff .
ifdef CVSPROJECT
cvsimport ::
cvs -m 'initial import' -d import $(CVSPROJECT)
endif
#--------------------------------------------------------------- Dependencies
# depend:: rcspull $(MAKEFILE) rcspush
depend :: $(DEPS)
undepend ::
@$(RM) -rf $(DEPSDIR)
# X11, InterViews
Makefile Makefiles ::
@echo $(THISFILE): requested target \"$@\" not supported, obsolete
# Only build dependencies if we're building some TARGETS...
# This way "make pure" won't stupidly create .depend, then remove it.
ifeq ($(MAKECMDGOALS),$(findstring $(MAKECMDGOALS),$(BUILDERS)))
-include $(DEPS)
endif
#-------------------------------------------------------------- TAGS Tables
tags :: TAGS
# GNU
TAGS ::
etags --typedefs-and-c++ --members --include=$$HOME/pod/Lib/TAGS \
--output=$@ $(ALLSRCS)
#-------------------------------------------------------------- info files
# GNU - generate .info files from .texi files using makeinfo
info :: $(INFO)
#-------------------------------------------------------------- DVI docs
# GNU - generate .dvi files from .texi files using texi2dvi
dvi :: $(DVI)
#------------------------------------------------------- regression testing
# Although used in some directories, this facility needs to be expanded
# to have a list of REGRESSORS to run, each of which should return a
# zero exit status on success.
# Execute the module compiled tests (*.t files)
ifdef TESTS
tests :: $(TESTS)
test :: all tests
@testoutdir=.tests ; \
[ -d $$testoutdir ] || mkdir $$testoutdir ; \
[ -d $$testoutdir ] || \
{ echo "could not create $$testoutdir." 1>&2 ; exit 1 ; } ; \
for test in $(TESTS) ; do \
echo Running test "$$test"... | tr -d '\012' ; \
if ./"$$test" \
>$$testoutdir/$$test.out 2>$$testoutdir/$$test.out ; then \
echo ' succeeded.' ; \
else \
echo " failed." ; exit 10 ; \
fi ; \
done
else
test ::
endif
# GNU - check of built (but not the installed) program
ifdef CHECKS
checks :: $(CHECKS)
check :: all checks
@for check in $(CHECKS) ; do \
echo Running check "$$check"... | tr -d '\012' ; \
if PROG=./$(PROG) "$$check" \
3<&1 1>$$check.out 2>$$check.err ; then \
if [ -r $$check.out.good ] ; then \
if diff $$check.out.good $$check.out ; then \
$(RM) $$check.out ; \
else \
echo "ERROR: contradicts $$check.out.good" 1>&2 ; \
exit 21 ; \
fi ; \
fi ; \
if [ -r $$check.err.good ] ; then \
if diff $$check.err.good $$check.err ; then \
$(RM) $$check.err ; \
else \
echo "ERROR: contradicts $$check.err.good" 1>&2 ; \
exit 22 ; \
fi ; \
fi ; \
echo ' succeeded.' ; \
else \
echo " failed." ; exit 20 ; \
fi ; \
done
else
check ::
endif
# GNU - installcheck of built (but not the installed) program
ifdef INSTALLCHECKS
installchecks :: $(INSTALLCHECKS)
installcheck :: all installchecks
@for installcheck in $(INSTALLCHECKS) ; do \
echo Running installcheck "$$installcheck"... | tr -d '\012' ; \
if PROG=$(DESTBIN)/$(PROG) "$$installcheck" \
1>$$installcheck.out 2>$$installcheck.err ; then \
if [ -r $$installcheck.out.good ] ; then \
if diff $$installcheck.out.good $$installcheck.out ; then \
$(RM) $$installcheck.out ; \