1#######
2# Where the executable goes
3BINDIR=/usr/local/bin
4
5#######
6# Man pages
7
8MANDIR=/usr/local/man/man1
9MANEXT=1
10
11#######
12# CC
13CC=gcc
14
15#######
16# Define's
17# Define STRINGS if <strings.h> is to be used in place of <string.h>
18# Define NOMEM if <memory.h> isn't available.
19# Define EBCDIC if that character set is used.
20DEFS =  -D_HPUX_SOURCE # -DNOMEM -DSTRINGS # -DEBCDIC
21
22# Sizes of shorts, ints, longs.  (This has to be a #define: the sizeof
23# operator isn't sufficient because we need to use the sizes in the argument
24# to a #if expression.)
25SIZES = -DL_SHORT=2 -DL_INT=4 -DL_LONG=4
26
27
28#######
29# CFLAGS
30# Always keep $(DEFS) and $(SIZES) in CFLAGS
31CFLAGS = -O $(DEFS) $(SIZES)
32
33#######
34# LDFLAGS,LDLIBS
35
36LDFLAGS=
37LDLIBS=
38
39
40####################################################################
41# You shouldn't have to modify anything below this line.
42####################################################################
43
44VIZOBJS = viz.o vizgrammar.o lists.o loadfile.o viz_decode.o
45VIZ_H = viz.h dep.h translate.h string.h memory.h version.h
46VIZSRC = viz.c vizgrammar.y lists.c loadfile.c viz_decode.c
47VIZSRC_C = viz.c vizgrammar.c lists.c loadfile.c viz_decode.c
48
49INVIZOBJS = inviz.o strtou.o strtod.o inviz_text.o inviz_num.o
50INVIZSRC = inviz.c strtou.c strtod.c inviz_text.c inviz_num.c
51
52ALL = README INSTALL Artistic Copying WhatsNew Makefile viz.1 inviz.1 $(VIZSRC) $(INVIZSRC) $(VIZ_H)
53
54all: viz inviz
55
56lint: $(VIZSRC_C)
57	lint -h $(VIZSRC_C) > lint.out
58
59viz:	$(VIZOBJS)
60	$(CC) $(LDFLAGS) $(DEFS) $(VIZOBJS) -o viz
61
62viz.o:	viz.h translate.h
63
64vizgrammar.o:	viz.h
65
66# For producing a .c file for lint to work on.
67vizgrammar.c: vizgrammar.y
68	@ echo "** Expect 4 shift/reduce conflicts **"
69	yacc vizgrammar.y
70	mv y.tab.c vizgrammar.c
71
72lists.o:	viz.h
73
74viz.h:	dep.h
75	@ touch viz.h
76
77inviz:	$(INVIZOBJS)
78	$(CC) $(LDFLAGS) $(INVIZOBJS) -lm -o inviz
79
80inviz.o:	viz.h translate.h
81
82viz_decode.o: viz.h translate.h
83	$(CC) $(CFLAGS) -DVIZ -c viz_decode.c
84
85inviz_text.o: viz.h translate.h
86	$(CC) $(CFLAGS) -c inviz_text.c
87
88inviz_num.o: viz.h translate.h
89	$(CC) $(CFLAGS) -c inviz_num.c
90
91install: viz inviz
92	cp viz $(BINDIR) && chmod 755 $(BINDIR)/viz
93	cp inviz $(BINDIR) && chmod 755 $(BINDIR)/inviz
94	cp viz.1 $(MANDIR)/viz.$(MANEXT) && \
95		chmod 644 $(MANDIR)/viz.$(MANEXT)
96	cp inviz.1 $(MANDIR)/inviz.$(MANEXT) && \
97		chmod 644 $(MANDIR)/inviz.$(MANEXT)
98
99clean:
100	rm -f *.o viz inviz y.tab.c y.tab.h
101
102# Because of the wide variation in shar commands, the shar arguments
103# used below sticks to a minimal set, and we generate various shar file
104# headers by hand.
105shar: $(ALL)
106	( echo "#include <stdio.h>" ; \
107	echo '#include "version.h"' ; \
108	echo 'main() {printf("%s.%s\\n",Version,Patchlevel);exit(0);}') > temp.c
109	cc temp.c
110	V=viz-`a.out`; mkdir $$V && cp $(ALL) $$V && \
111	    (echo "Submitted-by: will@nfra.nl" ; \
112	    echo "Archive-name: $$V/part01" ; echo "" ; \
113	    echo "---- Cut Here and feed the following to sh ----" ; \
114	    shar $$V ) > $$V.shar && rm -rf $$V
115	rm a.out temp.c
116