Imported Upstream version 2.5.1p3
[debian/amanda] / regex-src / Makefile
1 # You probably want to take -DREDEBUG out of CFLAGS, and put something like
2 # -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
3 # internal assertion checking and some debugging facilities).
4 # Put -Dconst= in for a pre-ANSI compiler.
5 # Do not take -DPOSIX_MISTAKE out.
6 # REGCFLAGS isn't important to you (it's for my use in some special contexts).
7 CFLAGS=-I. -DPOSIX_MISTAKE -DREDEBUG $(REGCFLAGS)
8
9 # If you have a pre-ANSI compiler, put -o into MKHFLAGS.  If you want
10 # the Berkeley __P macro, put -b in.
11 MKHFLAGS=
12
13 # Flags for linking but not compiling, if any.
14 LDFLAGS=
15
16 # Extra libraries for linking, if any.
17 LIBS=
18
19 # Internal stuff, should not need changing.
20 OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
21 OBJS=$(OBJPRODN) split.o debug.o main.o
22 H=cclass.h cname.h regex2.h utils.h
23 REGSRC=regcomp.c regerror.c regexec.c regfree.c
24 ALLSRC=$(REGSRC) engine.c debug.c main.c split.c
25
26 # Stuff that matters only if you're trying to lint the package.
27 LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
28 LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c main.c
29 JUNKLINT=possible pointer alignment|null effect
30
31 # arrangements to build forward-reference header files
32 .SUFFIXES:      .ih .h
33 .c.ih:
34         sh ./mkh -A $(MKHFLAGS) -p $< >$@
35
36 default:        r
37
38 lib:    purge $(OBJPRODN)
39         rm -f libregex.a
40         ar crv libregex.a $(OBJPRODN)
41
42 purge:
43         rm -f *.o
44
45 # stuff to build regex.h
46 REGEXH=regex.h
47 REGEXHSRC=regex2.h $(REGSRC)
48 $(REGEXH):      $(REGEXHSRC) mkh
49         sh ./mkh -A $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.tmp
50         cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
51         rm -f regex.tmp
52
53 # dependencies
54 $(OBJPRODN) debug.o:    utils.h regex.h regex2.h
55 regcomp.o:      cclass.h cname.h regcomp.ih
56 regexec.o:      engine.c engine.ih
57 regerror.o:     regerror.ih
58 debug.o:        debug.ih
59 main.o: main.ih
60
61 # tester
62 re:     $(OBJS)
63         $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
64
65 # regression test
66 r:      re tests
67         ./re <tests
68         ./re -el <tests
69         ./re -er <tests
70
71 # 57 variants, and other stuff, for development use -- not useful to you
72 ra:     ./re tests
73         -./re <tests
74         -./re -el <tests
75         -./re -er <tests
76
77 rx:     ./re tests
78         ./re -x <tests
79         ./re -x -el <tests
80         ./re -x -er <tests
81
82 t:      ./re tests
83         -time ./re <tests
84         -time ./re -cs <tests
85         -time ./re -el <tests
86         -time ./re -cs -el <tests
87
88 l:      $(LINTC)
89         lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
90
91 fullprint:
92         ti README WHATSNEW notes todo | list
93         ti *.h | list
94         list *.c
95         list regex.3 regex.7
96
97 print:
98         ti README WHATSNEW notes todo | list
99         ti *.h | list
100         list reg*.c engine.c
101
102
103 mf.tmp: Makefile
104         sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@
105
106 DTRH=cclass.h cname.h regex2.h utils.h
107 PRE=COPYRIGHT README WHATSNEW
108 POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
109 FILES=$(PRE) Makefile $(POST)
110 DTR=$(PRE) Makefile=mf.tmp $(POST)
111 dtr:    $(FILES) mf.tmp
112         makedtr $(DTR) >$@
113         rm mf.tmp
114
115 cio:    $(FILES)
116         cio $(FILES)
117
118 rdf:    $(FILES)
119         rcsdiff -c $(FILES) 2>&1 | p
120
121 # various forms of cleanup
122 tidy:
123         rm -f junk* core core.* *.core dtr *.tmp lint
124
125 clean:  tidy
126         rm -f *.o *.s *.ih re libregex.a
127
128 # don't do this one unless you know what you're doing
129 spotless:       clean
130         rm -f mkh regex.h
131
132 lint:
133