[9] | 1 | # Makefile for bc
|
---|
| 2 |
|
---|
| 3 | # A makefile for bc. This is part of the bc/sbc distribution.
|
---|
| 4 | #
|
---|
| 5 | #
|
---|
| 6 | # Make sure these have the correct directories for your machine.
|
---|
| 7 | #
|
---|
| 8 | # LIBDIR and BINDIR are where bc and libmath.b will be put.
|
---|
| 9 | #
|
---|
| 10 | PREFIX = /usr
|
---|
| 11 | LIBDIR = $(PREFIX)/lib
|
---|
| 12 | BINDIR = $(PREFIX)/bin
|
---|
| 13 | #
|
---|
| 14 | # Programs definitions for use by make.
|
---|
| 15 | #
|
---|
| 16 | SHELL = /bin/sh
|
---|
| 17 | YACC = yacc
|
---|
| 18 | #YACC = bison -y
|
---|
| 19 | LEX = flex -I8
|
---|
| 20 | #LEX = lex
|
---|
| 21 | CC = exec cc
|
---|
| 22 | CFLAGS = -D_POSIX_SOURCE
|
---|
| 23 | LDFLAGS = -i
|
---|
| 24 | #
|
---|
| 25 | #
|
---|
| 26 | OFILES = scan.o util.o main.o number.o storage.o load.o execute.o
|
---|
| 27 | #
|
---|
| 28 | SUBDIRS = Examples Test
|
---|
| 29 | #
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | all: bc
|
---|
| 33 | bc: $& config.h bc.o $(OFILES) global.o
|
---|
| 34 | $(CC) -o bc $(LDFLAGS) bc.o $(OFILES) global.o
|
---|
| 35 |
|
---|
| 36 | sbc: sbc.o $(OFILES) global.o
|
---|
| 37 | $(CC) -o sbc $(LDFLAGS) sbc.o $(OFILES) global.o
|
---|
| 38 |
|
---|
| 39 | math.h: libmath.b
|
---|
| 40 | $(MAKE) -$(MAKEFLAGS) fbc
|
---|
| 41 | ./fbc -c libmath.b </dev/null >math.h
|
---|
| 42 | /bin/sh ./fix_math.h
|
---|
| 43 | rm -f ./fbc
|
---|
| 44 |
|
---|
| 45 | fbc: $(OFILES) bc.o
|
---|
| 46 | echo \"\" > math.h
|
---|
| 47 | $(CC) -c $(CFLAGS) global.c
|
---|
| 48 | $(CC) -o fbc $(LDFLAGS) bc.o $(OFILES) global.o
|
---|
| 49 |
|
---|
| 50 | install: $(BINDIR)/bc $(LIBDIR)/libmath.b
|
---|
| 51 |
|
---|
| 52 | $(BINDIR)/bc: bc
|
---|
| 53 | install -cs -o bin $? $@
|
---|
| 54 |
|
---|
| 55 | $(LIBDIR)/libmath.b: libmath.b
|
---|
| 56 | install -c -o bin $? $@
|
---|
| 57 |
|
---|
| 58 | clean:
|
---|
| 59 | rm -f *.o *.bak core math.h bc sbc
|
---|
| 60 |
|
---|
| 61 | scan.c: scan.l
|
---|
| 62 | $(LEX) scan.l
|
---|
| 63 | mv lex.yy.c scan.c
|
---|
| 64 |
|
---|
| 65 | scan.o: scan.c
|
---|
| 66 | $(CC) -c $(CFLAGS) -wa scan.c
|
---|
| 67 |
|
---|
| 68 | y.tab.h bc.c: bc.y
|
---|
| 69 | @echo "expect 1 shift/reduce conflict"
|
---|
| 70 | $(YACC) -d bc.y
|
---|
| 71 | mv y.tab.c bc.c
|
---|
| 72 |
|
---|
| 73 | sbc.c: sbc.y
|
---|
| 74 | $(YACC) -d sbc.y
|
---|
| 75 | mv y.tab.c sbc.c
|
---|
| 76 |
|
---|
| 77 | global.o: bcdefs.h global.h math.h
|
---|
| 78 | bc.o: bcdefs.h global.h
|
---|
| 79 | execute.o: bcdefs.h global.h
|
---|
| 80 | load.o: bcdefs.h global.h
|
---|
| 81 | main.o: bcdefs.h global.h version.h
|
---|
| 82 | number.o: bcdefs.h
|
---|
| 83 | sbc.o: bcdefs.h global.h
|
---|
| 84 | scan.o: y.tab.h bcdefs.h global.h
|
---|
| 85 | storage.o: bcdefs.h global.h
|
---|
| 86 | util.o: bcdefs.h global.h version.h
|
---|
| 87 |
|
---|
| 88 | bcdefs.h: number.h const.h config.h
|
---|
| 89 | touch bcdefs.h
|
---|