-
Notifications
You must be signed in to change notification settings - Fork 52
/
Makefile
6006 lines (5808 loc) · 172 KB
/
Makefile
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
#!/usr/bin/env make
#
# calc - arbitrary precision calculator
#
# Copyright (C) 1999-2018,2021-2023 Landon Curt Noll
#
# Suggestion: Read the HOWTO.INSTALL file.
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of version 2.1 of the GNU Lesser General Public License
# as published by the Free Software Foundation.
#
# Calc is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details.
#
# A copy of version 2.1 of the GNU Lesser General Public License is
# distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# Under source code control: 1990/02/15 01:48:41
# File existed as early as: before 1990
#
# This calculator first developed by David I. Bell with help/mods from others.
#
# chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# SUGGESTION: Instead of modifying this file, consider adding
# statements to modify, replace or append Makefile
# variables in the Makefile.local file.
###########################################
# Files used or included by this Makefile #
###########################################
# Normally certain files depend on the Makefile. If the Makefile is
# changed, then certain steps should be redone. If MAKE_FILE is
# set to Makefile, then these files will depend on Makefile. If
# MAKE_FILE is empty, then they won't.
#
# If in doubt, set MAKE_FILE to Makefile
#
MAKE_FILE= Makefile
# Calc configuration and compile configuration values
#
CONFIG_MKF= Makefile.config
# Host target information.
#
TARGET_MKF= Makefile.target
# Local file that is included just prior to the first rule,
# that allows one to override any values set in this Makefile.
#
LOCAL_MKF= Makefile.local
# The set of Makefiles
#
MK_SET= ${MAKE_FILE} ${CONFIG_MKF} ${TARGET_MKF} ${LOCAL_MKF}
#######################################################
# Calc configuration and compile configuration values #
#######################################################
include ${CONFIG_MKF}
###############################
# host target section include #
###############################
include ${TARGET_MKF}
##########################################################################
#=-=-=-=-=- Be careful if you change something below this line -=-=-=-=-=#
##########################################################################
# Makefile debug
#
# Q=@ do not echo internal Makefile actions (quiet mode)
# Q= echo internal Makefile actions (debug / verbose mode)
#
# H=@: do not report hsrc file formation progress
# H=@ echo hsrc file formation progress
#
# S= >/dev/null 2>&1 silence ${CC} output during hsrc file formation
# S= full ${CC} output during hsrc file formation
#
# E= 2>/dev/null silence command stderr during hsrc file formation
# E= full command stderr during hsrc file formation
#
# V=@: do not echo debug statements (quiet mode)
# V=@ echo debug statements (debug / verbose mode)
#
# To turn all messages, use:
#
# Q=
# H=@
# S=
# E=
# V=@
#
#Q=
Q=@
#
S= >/dev/null 2>&1
#S=
#
E= 2>/dev/null
#E=
#
#H=@:
H=@
#
V=@:
#V=@
# the source files which are built into a math link library
#
# There MUST be a .o for every .c in LIBOBJS
#
LIBSRC= addop.c assocfunc.c blkcpy.c block.c byteswap.c \
codegen.c comfunc.c commath.c config.c const.c custom.c \
errtbl.c file.c func.c hash.c help.c hist.c input.c jump.c label.c \
lib_calc.c lib_util.c listfunc.c matfunc.c math_error.c \
obj.c opcodes.c pix.c poly.c prime.c qfunc.c qio.c \
qmath.c qmod.c qtrans.c quickhash.c seed.c sha1.c size.c \
str.c strl.c symbol.c token.c value.c version.c zfunc.c zio.c \
zmath.c zmod.c zmul.c zprime.c zrand.c zrandom.c
# the object files which are built into a math link library
#
# There MUST be a .o for every .c in LIBSRC
# which is built via this Makefile.
#
LIBOBJS= addop.o assocfunc.o blkcpy.o block.o byteswap.o \
codegen.o comfunc.o commath.o config.o const.o custom.o \
errtbl.o file.o func.o hash.o help.o hist.o input.o jump.o label.o \
lib_calc.o lib_util.o listfunc.o matfunc.o math_error.o \
obj.o opcodes.o pix.o poly.o prime.o qfunc.o qio.o \
qmath.o qmod.o qtrans.o quickhash.o seed.o sha1.o size.o \
str.o strl.o symbol.o token.o value.o version.o zfunc.o zio.o \
zmath.o zmod.o zmul.o zprime.o zrand.o zrandom.o
# the calculator source files
#
# There MUST be a .c for every .o in CALCOBJS.
#
CALCSRC= calc.c
# we build these .o files for calc
#
# There MUST be a .o for every .c in CALCSRC.
#
CALCOBJS= calc.o
# these .h files are needed to build the math link library
#
LIB_H_SRC= alloc.h attribute.h banned.h blkcpy.h block.h bool.h byteswap.h \
calc.h cmath.h config.h custom.h decl.h errtbl.h file.h func.h \
hash.h hist.h int.h jump.h label.h lib_calc.h lib_util.h nametype.h \
opcodes.h prime.h qmath.h sha1.h str.h strl.h symbol.h token.h \
value.h version.h zmath.h zrand.h zrandom.h
# we build these .h files during the make
#
BUILD_H_SRC= align32.h args.h charbit.h conf.h endian_calc.h errsym.h fposval.h \
have_arc4random.h have_ban_pragma.h have_const.h have_environ.h \
have_fgetsetpos.h have_fpos_pos.h have_getpgid.h have_getprid.h \
have_getsid.h have_gettime.h have_inttypes.h have_limits.h have_memmv.h \
have_newstr.h have_offscl.h have_posscl.h have_rusage.h have_statfs.h \
have_stdbool.h have_stdint.h have_stdlib.h have_strdup.h have_string.h \
have_strlcat.h have_strlcpy.h have_sys_mount.h have_sys_param.h \
have_sys_vfs.h have_times.h have_uid_t.h have_unistd.h have_unused.h \
have_urandom.h have_ustat.h longbits.h status.chk_c.h terminal.h
# we build these .c files during the make
#
BUILD_C_SRC=
# these .c files may be used in the process of building BUILD_H_SRC
#
# There MUST be a .c for every .o in UTIL_OBJS.
#
UTIL_C_SRC= align32.c charbit.c chk_c.c endian.c fposval.c have_arc4random.c \
have_ban_pragma.c have_const.c have_environ.c have_fgetsetpos.c \
have_fpos_pos.c have_getpgid.c have_getprid.c have_getsid.c \
have_gettime.c have_memmv.c have_newstr.c have_offscl.c have_posscl.c \
have_rusage.c have_statfs.c have_stdvs.c have_strdup.c have_strlcat.c \
have_strlcpy.c have_uid_t.c have_unused.c have_ustat.c have_varvs.c \
longbits.c
# these awk and sed tools are used in the process of building BUILD_H_SRC
# and BUILD_C_SRC
#
UTIL_MISC_SRC= fposval.h.def
# these .o files may get built in the process of building BUILD_H_SRC
#
# There MUST be a .o for every .c in UTIL_C_SRC.
#
UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \
have_const.o fposval.o have_fgetsetpos.o have_fpos_pos.o \
try_strarg.o have_stdvs.o have_varvs.o have_posscl.o have_memmv.o \
have_ustat.o have_getsid.o have_getpgid.o have_environ.o \
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o \
have_unused.o have_ban_pragma.o have_strlcpy.o have_strlcat.o \
have_arc4random.o charbit.o have_statfs.o chk_c.o
# these temp files may be created (and removed) during the build of BUILD_C_SRC
#
UTIL_TMP= ll_tmp fpos_tmp fposval_tmp const_tmp uid_tmp newstr_tmp vs_tmp \
memmv_tmp offscl_tmp posscl_tmp newstr_tmp \
getsid_tmp gettime_tmp getprid_tmp rusage_tmp strdup_tmp
# these utility executables may be created in the process of
# building the BUILD_H_SRC file set
#
UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \
endian${EXT} longbits${EXT} have_newstr${EXT} have_stdvs${EXT} \
have_varvs${EXT} have_ustat${EXT} have_getsid${EXT} \
have_getpgid${EXT} have_gettime${EXT} have_getprid${EXT} \
ver_calc${EXT} have_strdup${EXT} have_environ{EXT} \
have_unused${EXT} have_fpos${EXT} have_fpos_pos${EXT} \
have_offscl${EXT} have_rusage${EXT} have_ban_pragma${EXT} \
have_strlcpy${EXT} have_strlcat${EXT} have_arc4random${EXT} \
charbit${EXT} have_statfs${EXT} chk_c${EXT}
# these utility files and scripts may be created in the process of building
# the BUILD_H_SRC file set
#
UTIL_FILES= have_args.sh
# Any .h files that are needed to compile sample code.
#
SAMPLE_H_SRC=
# Any .c files that are needed to compile sample code.
#
# There MUST be a .c in SAMPLE_C_SRC for every .o in SAMPLE_OBJ.
#
SAMPLE_C_SRC= sample_many.c sample_rand.c
# Any .o files that are needed to compile sample code.
#
# There MUST be a .c in SAMPLE_C_SRC for every .o in SAMPLE_OBJ.
#
SAMPLE_OBJ= sample_many.o sample_rand.o
# complete list of .h files found (but not built) in the distribution
#
H_SRC= ${LIB_H_SRC} ${SAMPLE_H_SRC}
# complete list of .c files found (but not built) in the distribution
#
C_SRC= ${LIBSRC} ${CALCSRC} ${UTIL_C_SRC} ${SAMPLE_C_SRC}
# The list of files that describe calc's GNU Lesser General Public License
#
LICENSE= COPYING COPYING-LGPL
# These files are found (but not built) in the distribution
#
DISTLIST= ${C_SRC} ${H_SRC} ${MK_SET} ${UTIL_MISC_SRC} ${LICENSE} \
BUGS calc.man calc.spec.in CHANGES check.awk chk_tree CONTRIB-CODE \
HOWTO.INSTALL LIBRARY .lldbinit QUESTIONS README.FIRST README.md \
README.RELEASE README.WINDOWS rpm.mk sample.README trailblank update_ver
# These files are used to make (but not build) a calc .a link library
#
CALCLIBLIST= ${LIBSRC} ${UTIL_C_SRC} ${LIB_H_SRC} ${MK_SET} \
${UTIL_MISC_SRC} BUGS CHANGES LIBRARY
# complete list of .o files
#
OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJ}
# Static library build
# Libraries created and used to build calc
# Symlinks of dynamic shared libraries
# Early targets - things needed before the main build phase can begin
#
CALC_STATIC_LIBS= libcalc.a libcustcalc.a
CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION}
SYM_DYNAMIC_LIBS= libcalc${LIB_EXT} libcustcalc${LIB_EXT} \
libcalc${LIB_EXT_VER} libcustcalc${LIB_EXT_VER}
EARLY_TARGETS= errsym.h hsrc .hsrc custom/.all custom/Makefile
# list of sample programs that need to be built to satisfy sample rule
#
# NOTE: The ${SAMPLE_TARGETS} and ${SAMPLE_STATIC_TARGETS} are built but
# not installed at this time.
#
# NOTE: There must be a foo-static${EXT} in SAMPLE_STATIC_TARGETS for
# every foo${EXT} in ${SAMPLE_TARGETS}.
#
SAMPLE_TARGETS= sample_rand${EXT} sample_many${EXT}
SAMPLE_STATIC_TARGETS= sample_rand-static${EXT} sample_many-static${EXT}
# list of cscript programs that need to be built to satisfy cscript/.all
#
# NOTE: This list MUST be coordinated with the ${CSCRIPT_TARGETS} variable
# in the cscript/Makefile
#
CSCRIPT_TARGETS= cscript/mersenne cscript/piforever cscript/plus \
cscript/square cscript/fproduct cscript/powerterm
# dynamic first targets
#
DYNAMIC_FIRST_TARGETS= ${LICENSE} .dynamic
# static first targets
#
STATIC_FIRST_TARGETS= ${LICENSE} .static
# late targets - things needed after the main build phase is complete
#
LATE_TARGETS= calc.1 calc.usage calc.cat1 \
cal/.all help/.all help/builtin help/errorcodes \
cscript/.all
# calc tools - tools used by the maintainers of the calc source base
#
# Calc supplied tools:
#
# TRAILBLANK - find trailing blanks and other file format picky issues
# UPDATE_VER - update version numbers in Makefile.config
# CALC_TOOLS - the complete list of calc supplied tools
#
TRAILBLANK= trailblank
UPDATE_VER= update_ver
CALC_TOOLS= ${TRAILBLANK} ${UPDATE_VER}
# complete list of files that may be created as part of the build process
#
# Used by chk_tree via make prep
#
BUILD_ALL= ${LIBOBJS} ${CALCOBJS} ${BUILD_H_SRC} ${BUILD_C_SRC} \
${UTIL_OBJS} ${UTIL_TMP} ${UTIL_PROGS} ${SAMPLE_OBJ} \
${CALC_STATIC_LIBS} ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \
${SAMPLE_TARGETS} ${SAMPLE_STATIC_TARGETS} ${CSCRIPT_TARGETS} \
.dynamic .static ${LATE_TARGETS} calc${EXT} errcode${EXT} \
tags .hsrc outfile
# complete list of targets
#
TARGETS= ${EARLY_TARGETS} ${BLD_TYPE} ${LATE_TARGETS} ${CALC_TOOLS}
# rules that are not also names of files
#
PHONY= all check_include sample hsrc depend h_list calc_version version distlist \
buildlist distdir calcliblist calcliblistfmt verifydist check chk calcinfo \
env mkdebug full_debug debug testfuncsort prep run rpm inst_files \
olduninstall clean clobber install uninstall unbak splint strip
############################################################
# Allow Makefile.local to change any of the above settings #
############################################################
include ${LOCAL_MKF}
###########################################
# all - First and default Makefile target #
###########################################
all: check_include ${BLD_TYPE} CHANGES
###############################
# additional Makefile targets #
###############################
.PHONY: ${PHONY}
check_include:
${Q} if ! echo '#include <stdio.h>' | ${CC} -E - >/dev/null 2>&1; then \
echo "ERROR: Missing critical <stdio.h> include file." 1>&2; \
echo "Without critical include files, we cannot compile." 1>&2; \
echo "Perhaps your system isn't setup to compile C source?" 1>&2; \
echo 1>&2; \
echo "For example, Apple macOS / Darwin requires that XCode" 1>&2; \
echo "must be installed." 1>&2; \
echo 1>&2; \
echo "Also macOS users might later to run this command:" 1>&2; \
echo 1>&2; \
echo " xcode-select --install" 1>&2; \
echo 1>&2; \
exit 1; \
fi
calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} calc${EXT} \
${SAMPLE_TARGETS} ${LATE_TARGETS}
.dynamic: ${MK_SET}
${Q} d="calc-dynamic-only"; \
s="calc-static-only"; \
if [ "${BLD_TYPE}" != "$$d" ]; then \
echo "NOTE: The host target $(target) defaults to a build" 1>&2; \
echo " type of: ${BLD_TYPE}, so you need to use" 1>&2; \
echo " the following make command:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} $$d BLD_TYPE=$$d" 1>&2; \
echo "" 1>&2; \
echo "NOTE: It is a very good idea to first clobber any" 1>&2; \
echo " previously built .o, libs and executables" 1>&2; \
echo " before switching to $$d ." 1>&2; \
echo "" 1>&2; \
echo "=== aborting make ===" 1>&2; \
exit 1; \
fi
${Q} for i in .static calc-static${EXT} ${SAMPLE_STATIC_TARGETS} \
libcalc.a custom/libcustcalc.a; do \
d="calc-dynamic-only"; \
s="calc-static-only"; \
if [ -e "$$i" ]; then \
echo "Found the static target $$i file." 1>&2; \
echo "" 1>&2; \
echo "If you are trying to install the static calc, you must install using:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} $$s install BLD_TYPE=$$s" 1>&2; \
echo "" 1>&2; \
echo "Otherwise you need to first clean out previously built static files" 1>&2; \
echo "before trying to build and/or install dynamic calc:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
echo "" 1>&2; \
echo "=== aborting make ===" 1>&2; \
exit 2; \
fi; \
done
-${Q} ${TOUCH} $@
calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${CALC_STATIC_LIBS} calc-static${EXT} \
${SAMPLE_STATIC_TARGETS} ${LATE_TARGETS}
${Q} for i in calc${EXT} ${SAMPLE_TARGETS}; do \
if ${CMP} -s "$$i-static" "$$i"; then \
${TRUE}; \
else \
${RM} -f "$$i"; \
${LN} "$$i-static" "$$i"; \
fi; \
done
.static: ${MK_SET}
${Q} d="calc-static-only"; \
s="calc-static-only"; \
if [ "${BLD_TYPE}" != "$$s" ]; then \
echo "NOTE: The host target $(target) defaults to a build" 1>&2; \
echo " type of: ${BLD_TYPE}, so you need to use" 1>&2; \
echo " the following make command:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} $$s BLD_TYPE=$$s" 1>&2; \
echo "" 1>&2; \
echo "NOTE: It is a very good idea to first clobber any" 1>&2; \
echo " previously built .o, libs and executables" 1>&2; \
echo " before switching to $$s ." 1>&2; \
echo "" 1>&2; \
echo "=== aborting make ===" 1>&2; \
exit 3; \
fi
${Q} for i in .dynamic ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \
custom/libcustcalc${LIB_EXT_VERSION}; do \
d="calc-dynamic-only"; \
s="calc-static-only"; \
if [ -r "$$i" ]; then \
echo "Found the dynamic target $$i file. You must:" 1>&2; \
echo "" 1>&2; \
echo "If you are trying to install the dynamic calc, you must install using:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} $$d install BLD_TYPE=$$d" 1>&2; \
echo "" 1>&2; \
echo "Otherwise you need to first clean out previously built dynamic files" 1>&2; \
echo "before trying to build and/or install static calc:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
echo "" 1>&2; \
echo "=== aborting make ===" 1>&2; \
exit 4; \
fi; \
done
-${Q} ${TOUCH} $@
calc${EXT}: .hsrc ${CALCOBJS} ${CALC_DYNAMIC_LIBS} ${MK_SET}
${RM} -f $@
${CC} ${CALCOBJS} ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
libcalc${LIB_EXT_VERSION}: ${LIBOBJS} ver_calc${EXT} ${MK_SET} libcustcalc${LIB_EXT_VERSION}
${CC} ${LIBCALC_SHLIB} ${LIBOBJS} libcustcalc${LIB_EXT_VERSION} \
${READLINE_LIB} ${READLINE_EXTRAS} -o libcalc${LIB_EXT_VERSION}
libcalc${LIB_EXT}: libcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
libcalc${LIB_EXT_VER}: libcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
###
#
# calc documentation
#
###
# Note: The :\(...-sed pattern below allows word wrapping at the separators
# of long path names (typically CALCPATH and CALCRC).
calc.1: calc.man ${MK_SET}
${RM} -f $@
${Q} echo forming calc.1 from calc.man
@${SED} -e 's:$${LIBDIR}:${LIBDIR}:g' \
-e 's,$${BINDIR},${BINDIR},g' \
-e 's,$${VERSION},${VERSION},g' \
-e 's,$${CALCPATH},${CALCPATH},g' \
-e 's,$${SCRIPTDIR},${SCRIPTDIR},g' \
-e 's,$${CALC_INCDIR},${CALC_INCDIR},g' \
-e 's,$${CUSTOMCALDIR},${CUSTOMCALDIR},g' \
-e 's,$${CUSTOMINCDIR},${CUSTOMINCDIR},g' \
-e 's,$${HELPDIR},${HELPDIR},g' \
-e 's,$${CUSTOMHELPDIR},${CUSTOMHELPDIR},g' \
-e 's,$${CALCRC},${CALCRC},g' \
-e 's,:\([/.~]\),:\\:\1,g' < calc.man > calc.1
${Q} echo calc.1 formed
calc.usage: calc.1
${Q} echo forming $@ from calc.1
${RM} -f $@
${MAN} ./calc.1 > $@
${CHMOD} 0444 $@
${Q} echo $@ formed
calc.cat1: calc.usage
${Q} echo forming $@ from calc.usage
${RM} -f $@
${GZIP} --best -f -c calc.usage > $@
${CHMOD} 0444 $@
${Q} echo $@ formed
##
#
# These rules compile the sample code against the calc library
#
##
sample: ${SAMPLE_TARGETS}
sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MK_SET}
${CC} sample_rand.o ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
sample_many${EXT}: sample_many.o ${CALC_DYNAMIC_LIBS} ${MK_SET}
${CC} sample_many.o ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
###
#
# Special .o files that may need special compile options
#
###
hist.o: hist.c ${MK_SET}
${CC} ${CFLAGS} -Wno-strict-prototypes ${TERMCONTROL} ${USE_READLINE} ${READLINE_INCLUDE} \
-c hist.c
seed.o: seed.c ${MK_SET}
${CC} ${CFLAGS} ${WNO_IMPLICT} ${WNO_ERROR_LONG_LONG} \
${WNO_LONG_LONG} -c seed.c
file.o: file.c ${MK_SET}
${CC} ${CFLAGS} ${WNO_ERROR_LONG_LONG} ${WNO_LONG_LONG} -c file.c
###
#
# The next set of rules cause the .h files BUILD_H_SRC files to be built
# according to the system and the Makefile variables above. The hsrc rule
# is a convenient rule to invoke to build all of the BUILD_H_SRC.
#
# We add in the BUILD_C_SRC files because they are similar to the
# BUILD_H_SRC files in terms of the build process.
#
# NOTE: Due to bogus shells found on one common system we must have
# an non-empty else clause for every if condition. *sigh*
# We also place ; ${TRUE} at the end of some commands to avoid
# meaningless cosmetic messages by the same system.
#
###
hsrc: ${BUILD_H_SRC} ${BUILD_C_SRC} chk_c${EXT}
.hsrc: ${BUILD_H_SRC} ${BUILD_C_SRC}
${Q} ${RM} -f .hsrc
-${Q} ${TOUCH} .hsrc
conf.h: ${MK_SET}
${Q} ${RM} -f $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_CONF_H)' >> $@
${Q} echo '#define CALC_CONF_H' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '/* the default :-separated search path */' >> $@
${Q} echo '#if !defined(DEFAULTCALCPATH)' >> $@
${Q} echo '#define DEFAULTCALCPATH "${CALCPATH}"' >> $@
${Q} echo '#endif /* DEFAULTCALCPATH */' >> $@
${Q} echo '' >> $@
${Q} echo '/* the default :-separated startup file list */' >> $@
${Q} echo '#if !defined(DEFAULTCALCRC)' >> $@
${Q} echo '#define DEFAULTCALCRC "${CALCRC}"' >> $@
${Q} echo '#endif /* DEFAULTCALCRC */' >> $@
${Q} echo '' >> $@
${Q} echo '/* the location of the help directory */' >> $@
${Q} echo '#if !defined(HELPDIR)' >> $@
ifdef RPM_TOP
${Q} echo '#define HELPDIR "${HELPDIR}"' >> $@
else # RPM_TOP
${Q} echo '#define HELPDIR "${T}${HELPDIR}"' >> $@
endif # RPM_TOP
${Q} echo '#endif /* HELPDIR */' >> $@
${Q} echo '' >> $@
${Q} echo '/* the location of the custom help directory */' >> $@
${Q} echo '#if !defined(CUSTOMHELPDIR)' >> $@
ifdef RPM_TOP
${Q} echo '#define CUSTOMHELPDIR "${CUSTOMHELPDIR}"' >> $@
else # RPM_TOP
${Q} echo '#define CUSTOMHELPDIR "${T}${CUSTOMHELPDIR}"' >> $@
endif # RPM_TOP
${Q} echo '#endif /* CUSTOMHELPDIR */' >> $@
${Q} echo '' >> $@
${Q} echo '/* the default pager to use */' >> $@
${Q} echo '#if !defined(DEFAULTCALCPAGER)' >> $@
${Q} echo '#define DEFAULTCALCPAGER "${CALCPAGER}"' >> $@
${Q} echo '#endif /* DEFAULTCALCPAGER */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !CALC_CONF_H */' >> $@
${H} echo '$@ formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
endian_calc.h: endian.c have_stdlib.h have_unistd.h \
banned.h have_ban_pragma.h ${MK_SET}
${Q} ${RM} -f endian.o endian${EXT} $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(ENDIAN_CALC_H)' >> $@
${Q} echo '#define ENDIAN_CALC_H' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '/* what byte order are we? */' >> $@
-${Q} if [ X"${CALC_BYTE_ORDER}" = X ]; then \
if echo '#include <endian.h>' | ${CC} -E - ${S}; then \
echo '#include <endian.h>' >> $@; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> $@; \
elif echo '#include <machine/endian.h>' | \
${CC} -E - ${S}; then \
echo '#include <machine/endian.h>' >> $@; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> $@; \
elif echo '#include <sys/endian.h>' | \
${CC} -E- ${S}; then \
echo '#include <sys/endian.h>' >> $@; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> $@; \
else \
${LCC} ${ICFLAGS} ${CALC_BYTE_ORDER} endian.c -c ${S}; \
${LCC} ${ILDFLAGS} endian.o -o endian${EXT} ${S}; \
./endian${EXT} >> $@; \
${RM} -f endian.o endian${EXT}; \
fi; \
else \
${LCC} ${ICFLAGS} ${CALC_BYTE_ORDER} endian.c -c ${S}; \
${LCC} ${ILDFLAGS} endian.o -o endian${EXT} ${S}; \
./endian${EXT} >> $@; \
${RM} -f endian.o endian${EXT}; \
fi
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !ENDIAN_CALC_H */' >> $@
${H} echo '$@ formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
charbit.h: charbit.c have_limits.h \
banned.h have_ban_pragma.h ${MK_SET}
${Q} ${RM} -f charbit.o charbit${EXT} $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_CHARBIT_H)' >> $@
${Q} echo '#define CALC_CHARBIT_H' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
-@if [ -z ${CALC_CHARBIT} ]; then \
${LCC} ${ICFLAGS} charbit.c -c ${S}; \
${LCC} ${ILDFLAGS} charbit.o -o charbit${EXT} ${S}; \
./charbit${EXT} >> $@ ${E}; \
else \
echo '#define CALC_CHARBIT ${CALC_CHARBIT} ' \
'/* set by Makefile.ship */' >> $@; \
fi
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !CALC_CHARBIT_H */' >> $@
${H} echo '$@ formed'
${Q} ${RM} -f charbit.o charbit${EXT}
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
longbits.h: longbits.c charbit.h have_unistd.h have_stdlib.h \
banned.h have_ban_pragma.h ${MK_SET}
${Q} ${RM} -f longbits.o longbits${EXT} $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_LONGBITS_H)' >> $@
${Q} echo '#define CALC_LONGBITS_H' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} ${LCC} ${ICFLAGS} longbits.c -c ${S}
${Q} ${LCC} ${ILDFLAGS} longbits.o -o longbits${EXT} ${S}
${Q} ./longbits${EXT} ${LONG_BITS} >> $@ ${E}
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !CALC_LONGBITS_H */' >> $@
${H} echo '$@ formed'
${Q} ${RM} -f longbits.o longbits${EXT}
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
have_times.h: ${MK_SET}
${Q} ${RM} -f $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_HAVE_TIMES_H)' >> $@
${Q} echo '#define CALC_HAVE_TIMES_H' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '/* do we have <times.h>? */' >> $@
-${Q} if [ X"${HAVE_TIMES_H}" = X"YES" ]; then \
echo '#define HAVE_TIMES_H /* yes */' >> $@; \
elif [ X"${HAVE_TIMES_H}" = X"NO" ]; then \
echo '#undef HAVE_TIMES_H /* no */' >> $@; \
elif echo '#include <times.h>' | ${CC} -E - ${S}; then \
echo '#define HAVE_TIMES_H /* yes */' >> $@; \
else \
echo '#undef HAVE_TIMES_H /* no */' >> $@; \
fi
${Q} echo '/* do we have <sys/times.h>? */' >> $@
-${Q} if [ X"${HAVE_SYS_TIMES_H}" = X"YES" ]; then \
echo '#define HAVE_SYS_TIMES_H /* yes */' >> $@; \
elif [ X"${HAVE_SYS_TIMES_H}" = X"NO" ]; then \
echo '#undef HAVE_SYS_TIMES_H /* no */' >> $@; \
elif echo '#include <sys/times.h>' | ${CC} -E - ${S}; then \
echo '#define HAVE_SYS_TIMES_H /* yes */' >> $@; \
else \
echo '#undef HAVE_SYS_TIMES_H /* no */' >> $@; \
fi
${Q} echo '/* do we have <time.h>? */' >> $@
-${Q} if [ X"${HAVE_TIME_H}" = X"YES" ]; then \
echo '#define HAVE_TIME_H /* yes */' >> $@; \
elif [ X"${HAVE_TIME_H}" = X"NO" ]; then \
echo '#undef HAVE_TIME_H /* no */' >> $@; \
elif echo '#include <time.h>' | ${CC} -E - ${S}; then \
echo '#define HAVE_TIME_H /* yes */' >> $@; \
else \
echo '#undef HAVE_TIME_H /* no */' >> $@; \
fi
${Q} echo '/* do we have <sys/time.h>? */' >> $@
-${Q} if [ X"${HAVE_SYS_TIME_H}" = X"YES" ]; then \
echo '#define HAVE_SYS_TIME_H /* yes */' >> $@; \
elif [ X"${HAVE_SYS_TIME_H}" = X"NO" ]; then \
echo '#undef HAVE_SYS_TIME_H /* no */' >> $@; \
elif echo '#include <sys/time.h>' | ${CC} -E - ${S}; then \
echo '#define HAVE_SYS_TIME_H /* yes */' >> $@; \
else \
echo '#undef HAVE_SYS_TIME_H /* no */' >> $@; \
fi
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !CALC_HAVE_TIMES_H */' >> $@
${H} echo '$@ formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
have_stdlib.h: ${MK_SET}
${Q} ${RM} -f $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_HAVE_STDLIB_H)' >> have_stdlib.h
${Q} echo '#define CALC_HAVE_STDLIB_H' >> have_stdlib.h
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '/* do we have <stdlib.h>? */' >> $@
-${Q} if [ X"${HAVE_STDLIB_H}" = X"YES" ]; then \
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
elif [ X"${HAVE_STDLIB_H}" = X"NO" ]; then \
echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \
elif echo '#include <stdlib.h>' | ${CC} -E - ${S}; then \
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
else \
echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \
fi
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !CALC_HAVE_STDLIB_H */' >> have_stdlib.h
${H} echo '$@ formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
have_unistd.h: ${MK_SET}
${Q} ${RM} -f $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_HAVE_UNISTD_H)' >> $@
${Q} echo '#define CALC_HAVE_UNISTD_H' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '/* do we have <unistd.h>? */' >> $@
-${Q} if [ X"${HAVE_UNISTD_H}" = X"YES" ]; then \
echo '#define HAVE_UNISTD_H /* yes */' >> $@; \
elif [ X"${HAVE_UNISTD_H}" = X"NO" ]; then \
echo '#undef HAVE_UNISTD_H /* no */' >> $@; \
elif echo '#include <unistd.h>' | ${CC} -E - ${S}; then \
echo '#define HAVE_UNISTD_H /* yes */' >> $@; \
else \
echo '#undef HAVE_UNISTD_H /* no */' >> $@; \
fi
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !CALC_HAVE_UNISTD_H */' >> $@
${H} echo '$@ formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
have_limits.h: ${MK_SET}
${Q} ${RM} -f $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_HAVE_LIMITS_H)' >> $@
${Q} echo '#define CALC_HAVE_LIMITS_H' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '/* do we have <limits.h>? */' >> $@
-${Q} if [ X"${HAVE_LIMITS_H}" = X"YES" ]; then \
echo '#define HAVE_LIMITS_H /* yes */' >> $@; \
elif [ X"${HAVE_LIMITS_H}" = X"NO" ]; then \
echo '#undef HAVE_LIMITS_H /* no */' >> $@; \
elif echo '#include <limits.h>' | ${CC} -E - ${S}; then \
echo '#define HAVE_LIMITS_H /* yes */' >> $@; \
else \
echo '#undef HAVE_LIMITS_H /* no */' >> $@; \
fi
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !CALC_HAVE_LIMITS_H */' >> $@
${H} echo '$@ formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
have_stdbool.h: ${MK_SET}
${Q} ${RM} -f $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_HAVE_STDBOOL_H)' >> $@
${Q} echo '#define CALC_HAVE_STDBOOL_H' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '/* do we have <stdbool.h>? */' >> $@
-${Q} if [ X"${HAVE_STDBOOL_H}" = X"YES" ]; then \
echo '#define HAVE_STDBOOL_H /* yes */' >> $@; \
elif [ X"${HAVE_STDBOOL_H}" = X"NO" ]; then \
echo '#undef HAVE_STDBOOL_H /* no */' >> $@; \
elif echo '#include <stdbool.h>' | ${CC} -E - ${S}; then \
echo '#define HAVE_STDBOOL_H /* yes */' >> $@; \
else \
echo '#undef HAVE_STDBOOL_H /* no */' >> $@; \
fi
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#endif /* !CALC_HAVE_STDBOOL_H */' >> $@
${H} echo '$@ formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
${CAT} $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
have_stdint.h: ${MK_SET}
${Q} ${RM} -f $@
${H} echo 'forming $@'
${Q} echo '/*' > $@
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
${Q} echo ' */' >> $@
${Q} echo '' >> $@
${Q} echo '' >> $@
${Q} echo '#if !defined(CALC_HAVE_STDINT_H)' >> $@