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
|
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -1,45 +1,49 @@
-CFLAGS =
+CFLAGS +=
CWEAVE = cweavex +d
CTANGLE = ctanglex
-.SUFFIXES: .tex .dvi .w
+
+all: treeprint treeprint.pdf wc wc.pdf wmerge wmerge.pdf
+
+.SUFFIXES: .tex .dvi .w .pdf
.w.tex:
$(CWEAVE) $*
-.tex.dvi:
+.tex.dvi:
tex $*
-
-.w.dvi:
- $(CWEAVE) $*
- tex $*
+.tex.pdf:
+ pdftex $*
.w.c:
$(CTANGLE) $*
-.w.o:
- $(CTANGLE) $*
- $(CC) $(CFLAGS) -c $*.c
-
.w.dvi:
- make $*.tex
- make $*.dvi
+ $(MAKE) $*.tex
+ $(MAKE) $*.dvi
+
+.w.pdf:
+ $(MAKE) $*.tex
+ $(MAKE) $*.pdf
.w.o:
- make $*.c
- make $*.o
+ $(MAKE) $*.c
+ $(MAKE) $*.o
treeprint: treeprint.w
- make treeprint.c
- make treeprint
+ $(MAKE) treeprint.o
+ $(CC) $(CFLAGS) -o treeprint treeprint.o
wc: wc.w
- make wc.c
- make wc
-
-wmerge: wmerge.w
- make wmerge.o
- $(CC) $(CFLAGS) -o wmerge wmerge.o ../common.o
-
+ $(MAKE) wc.o
+ $(CC) $(CFLAGS) -o wc wc.o
-
+wmerge: wmerge.w common.o
+ $(MAKE) wmerge.o
+ $(CC) $(CFLAGS) -o wmerge wmerge.o common.o
+
+.PHONY: clean
+
+clean:
+ rm -f *.o *.c *.tex *.dvi *.pdf *.log *.toc
+ rm -f treeprint wc wmerge common.h
--- a/examples/wmerge.w
+++ b/examples/wmerge.w
@@ -10,11 +10,11 @@
banner is produced anyway.
@h <stdio.h>
-@h "../common.h" /* the header file for \.{CWEB}'s \.{common.w} */
+@h "common.h" /* the header file for \.{CWEB}'s \.{common.w} */
@c
@< Prototype @>@;
main (int argc,char** argv)
-{ common_init(argc,argv);
+{ common_init(argc,argv,"x3.52");
flags['h']=flags['p']=0;
reset_input();
while (get_line())
|