summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/bc/Makefile.in
blob: f3a78dced9080c54ddf5b6c549964f6d7a3fde6b (plain)
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
# Makefile for GNU bc and dc.	-*- Indented-Text -*-
# Copyright (C) 1993, 1994 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program 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 General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# @configure_input@

#### Start of system configuration section. ####

srcdir = @srcdir@
VPATH = @srcdir@

prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = $(exec_prefix)/bin
datadir = $(prefix)/lib
libdir = $(prefix)/lib
infodir = $(prefix)/info

# Where to install the manual pages.
mandir = $(prefix)/man/man1
# Extension (not including `.') for the installed manual page filenames.
manext = 1

#
# This is the name of the library file, if needed.  This definition should
# not be deleted.
#
LIBFILE = $(libdir)/libmath.b

#
# Programs definitions for use by make.
#

SHELL = /bin/sh
YACC = @YACC@
LEX = @LEX@
CC = @CC@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

UUENCODE = uue

LIBS = @LIBS@ @LEXLIB@

CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@

MAKEINFO = makeinfo
TEXI2DVI = texi2dvi

# stuff for cflags

STDDEFS = -D_POSIX_SOURCE -DDOT_IS_LAST
INCDIR = -I. -I$(srcdir)

#
#  The following are the standard definitions.  For MINIX PC, you need to
#  comment these out and select one of the MINIX PC definition sets.
#  Other configuration defines are generated automatically.  See the 
#  README file for more details.
#
O=o
CFLAGS = -O $(INCDIR) $(STDDEFS) @CFLAGS@
LDFLAGS = 
#
# For the PC version of MINIX (K&R compiler), use the following lines.
# 
#O=s
#CFLAGS = -O $(INCDIR) $(STDDEFS) @CFLAGS@
#LDFLAGS = -i
#
# For the PC version of MINIX (ANSI compiler), use the following lines:
# 
#O=o
#CFLAGS = -m $(INCDIR) $(STDDEFS) @CFLAGS@
#LDFLAGS = -i
#
#
DISTFILES = COPYING Makefile.in Install bc.y bcdefs.h const.h version.h \
            execute.c global.c global.h load.c main.c number.c storage.c \
	    number.h proto.h scan.l util.c vfprintf.c README bc.1 sbc.y \
	    fix_libmath.h libmath.b configure configure.in config.h.in \
	    acconfig.h ChangeLog \
	    dc.1 dc.texinfo \
 	    dc-array.c dc-eval.c dc-misc.c dc-number.c dc-stack.c \
	    dc-string.c dc.h dc-proto.h dc-regdef.h dc-version.h \
	    install-sh
#
BCOFILES = scan.$O util.$O main.$O number.$O storage.$O load.$O execute.$O 
DCOFILES = dc-misc.$O dc-eval.$O dc-stack.$O dc-array.$O dc-string.$O \
	   dc-number.$O
#
SUBDIRS = Examples Test
#
EXTRAFILES = bc.c.dist scan.c.dist y.tab.h.dist libmath.h dc.info
#

all: bc dc dc.info

### targets required by GNU Coding standards ###

Makefile: Makefile.in config.status
	./config.status

#config.status: configure
#	$(srcdir)/configure --srcdir=$(srcdir) --no-create
#
#configure: configure.in
#	cd $(srcdir); autoconf

bc: $& config.h bc.$O $(BCOFILES) global.$O
	$(CC) $(LDFLAGS) -o bc bc.$O $(BCOFILES) global.$O $(LIBS)

dc: $(DCOFILES) number.o
	$(CC) $(LDFLAGS) -o dc $(DCOFILES) number.o $(LIBS)

sbc: sbc.$O $(BCOFILES) global.$O
	$(CC) -o sbc $(LDFLAGS) sbc.$O $(BCOFILES) global.$O $(LIBS)

config.h.in:
	autoheader

config.h:	config.h.in configure
	./configure

libmath.h: libmath.b
	$(MAKE) fbc
	./fbc -c libmath.b </dev/null >libmath.h
	./fix_libmath.h
	rm -f ./fbc

fbc: $(BCOFILES) bc.$O
	echo \"\" > libmath.h
	$(CC) -c $(CFLAGS) global.c
	$(CC) -o fbc $(LDFLAGS) bc.$O $(BCOFILES) global.$O $(LEXLIB)

install: installdirs bc libmath.b config.h
	rm -f $(bindir)/bc $(bindir)/dc
	$(INSTALL_PROGRAM) bc $(bindir)
	$(INSTALL_PROGRAM) dc $(bindir)
	chmod 555 $(bindir)/bc $(bindir)/dc
	if grep -s "define BC_MATH_FILE" config.h; \
	  then rm -f $(libdir)/libmath.b; \
	  $(INSTALL_DATA) $(srcdir)/libmath.b $(libdir); \
	  chmod 444 $(libdir)/libmath.b; \
	  else true; \
	fi
	$(INSTALL_DATA) $(srcdir)/bc.1 $(mandir)
	$(INSTALL_DATA) $(srcdir)/dc.1 $(mandir)
	$(INSTALL_DATA) $(srcdir)/dc.info $(infodir)

installdirs:
	-mkdir $(prefix)
	-mkdir $(bindir)
	-if grep -s "define BC_MATH_FILE" config.h; \
	  then mkdir $(libdir)
	  else true; \
	fi
	-mkdir $(mandir)
	-mkdir $(infodir)

uninstall: 
	rm -f $(bindir)/bc $(bindir)/dc
	if grep -s "define BC_MATH_FILE" config.h; \
	  then rm -f $(libdir)/libmath.b;
	  else true; \
	fi
	rm -f $(mandir)/bc1 $(mandir)/dc.1
	rm -f $(infodir)/dc.info

dist: $(EXTRAFILES)
	OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
	; rm -rf $$OF \
	; mkdir $$OF \
	; chmod 777 $$OF \
	; for file in $(DISTFILES) ; do ln $(srcdir)/$$file $$OF/$$file; done \
	; for file in $(EXTRAFILES) ; do ln $$file $$OF/$$file; done \
	; for dir in $(SUBDIRS); do \
	   mkdir $$OF/$$dir ; chmod 777 $$OF/$$dir ; \
	   cp $(srcdir)/$$dir/* $$OF/$$dir; done \
	; tar cf $$OF.tar $$OF \
	; gzip $$OF.tar \
	; rm -rf $$OF

shars: dist
	OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
	; $(UUENCODE) $$OF.tar.Z - > $$OF.uue \
	; split -775 $$OF.uue $$OF-u. \
	; for file in $$OF-u.a?; do shar $$file > $$file.sh; done

minixdist: $(EXTRAFILES)
	OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
	; rm -rf $$OF \
	; mkdir $$OF \
	; cd $$OF \
	; for file in $(DISTFILES) $(EXTRAFILES); do ln ../$$file; done \
	; cd .. \
	; tar cf $$OF.tar $$OF \
	; gzip $$OF.tar \
	; rm -rf $$OF

minixshars: minixdist
	OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
	; $(UUENCODE) $$OF.tar.Z - > $$OF.uue \
	; split -775 $$OF.uue $$OF-u. \
	; for file in $$OF-u.a?; do shar $$file > $$file.sh; done

csrshars: $(EXTRAFILES)
	findsrc -dy $(DISTFILES) $(EXTRAFILES) $(SUBDIRS) | \
	makekit -npart -oMANIFEST

bc.c.dist: bc.c
	cp bc.c bc.c.dist

scan.c.dist: scan.c
	cp scan.c scan.c.dist

y.tab.h.dist: y.tab.h
	cp y.tab.h y.tab.h.dist

extra:  $(EXTRAFILES)

# assumes that the extra files exist!
derived: 
	@if [ ! -f $(srcdir)/bc.c.dist ] ; then \
	  echo "You do not have a complete distribution.  Get a new copy or"; \
	  echo "see if you can make the derived files using lex and yacc."; \
	  exit 1; \
	fi
	cp $(srcdir)/bc.c.dist bc.c
	cp $(srcdir)/scan.c.dist scan.c
	cp $(srcdir)/y.tab.h.dist y.tab.h

clean:
	rm -f *.$O core ERRS *~ *.bak *.Z 

distclean: clean
	rm -f scan.c y.tab.h bc.c sbc.c bc sbc bc-dist* config.h  bc-*.* \
	dc part?? MANIFEST* config.h config.status config.log config.cache \
	Makefile *.aux *.cp *.dvi *.fn *.ky *.log *.pg *.toc *.tp *.vr

mostlyclean: distclean

realclean: distclean
	rm -rf *.dist configure libmath.h dc.info config.h.in

scan.c: scan.l
	$(LEX) scan.l
	mv lex.yy.c scan.c

y.tab.h bc.c: bc.y
	@echo "expect 1 shift/reduce conflict"
	$(YACC) -d bc.y
	mv y.tab.c bc.c

sbc.c: sbc.y
	$(YACC) -d sbc.y
	mv y.tab.c sbc.c

# Information files
info: dc.info
dvi: dc.dvi

#bc.info: bc.texinfo
#	$(MAKEINFO) -I$(srcdir) --no-split bc.texinfo
#
#bc.dvi: bc.texinfo
#	$(TEXI2DVI) $(srcdir)/bc.texinfo

dc.info: dc.texinfo
	$(MAKEINFO) -I$(srcdir) --no-split dc.texinfo

dc.dvi: dc.texinfo
	$(TEXI2DVI) $(srcdir)/dc.texinfo


global.$O:  bcdefs.h global.h libmath.h global.c
bc.$O:	    bcdefs.h global.h bc.y
execute.$O: bcdefs.h global.h execute.c
load.$O:    bcdefs.h global.h load.c
main.$O:    bcdefs.h global.h version.h main.c
number.$O:  bcdefs.h Makefile number.c
sbc.$O:     bcdefs.h global.h sbc.y
scan.$O:    bcdefs.h global.h y.tab.h scan.c
storage.$O: bcdefs.h global.h storage.c
util.$O:    bcdefs.h global.h version.h util.c

bcdefs.h: number.h const.h config.h
	touch bcdefs.h

dc-array.$O : dc-array.c config.h dc.h dc-proto.h dc-regdef.h 
dc-eval.$O : dc-eval.c config.h dc.h dc-proto.h 
dc-misc.$O : dc-misc.c config.h dc.h dc-proto.h dc-version.h 
dc-number.$O : dc-number.c config.h bcdefs.h const.h version.h number.h \
  proto.h global.h dc.h dc-proto.h 
dc-stack.$O : dc-stack.c config.h dc.h dc-proto.h dc-regdef.h 
dc-string.$O : dc-string.c config.h dc.h dc-proto.h 
number.$O : number.c bcdefs.h config.h const.h version.h number.h proto.h