]> git.sur5r.net Git - openldap/blob - build/unproto/Makefile
Fix BYTE_ORDER test.
[openldap] / build / unproto / Makefile
1 # @(#) Makefile 1.6 93/06/18 22:29:40
2
3 ## BEGIN CONFIGURATION STUFF
4
5 # In the unlikely case that your compiler has no hooks for alternate
6 # compiler passes, use a "cc cflags -E file.c | unproto >file.i"
7 # pipeline, then "cc cflags -c file.i" to compile the resulting
8 # intermediate file.
9
10 # Otherwise, the "/lib/cpp | unproto" pipeline can be packaged as an
11 # executable shell script (see the provided "cpp.sh" script) that should
12 # be installed as "/whatever/cpp". This script should then be specified
13 # to the C compiler as a non-default preprocessor.
14 #
15 # PROG  = unproto
16 # PIPE  =
17
18 # The overhead and problems of shell script interpretation can be
19 # eliminated by having the unprototyper program itself open the pipe to
20 # the preprocessor.  In that case, define the PIPE_THROUGH_CPP macro as
21 # the path name of the default C preprocessor (usually "/lib/cpp"),
22 # install the unprototyper as "/whatever/cpp" and specify that to the C
23 # compiler as a non-default preprocessor.
24 #
25 PROG    = cpp
26 PIPE    = -DPIPE_THROUGH_CPP=\"/lib/cpp\"
27
28 # Some compilers complain about some #directives. The following is only a
29 # partial solution, because the directives are still seen by /lib/cpp.
30 # Be careful with filtering out #pragma, because some pre-ANSI compilers
31 # (SunOS) rely on its use.
32 #
33 # SKIP  = -DIGNORE_DIRECTIVES=\"pragma\",\"foo\",\"bar\"
34 #
35 SKIP    =
36
37 # The bell character code depends on the character set. With ASCII, it is
38 # 7. Specify a string constant with exactly three octal digits. If you
39 # change this definition, you will have to update the example.out file.
40 #
41 BELL    = -DBELL=\"007\"
42
43 # Some C compilers have problems with "void".  The nature of the problems
44 # depends on the age of the compiler.
45 #
46 # If your compiler does not understand "void" at all, compile with
47 # -DMAP_VOID. The unprototyper will replace "void *" by "char *", a
48 # (void) argument list by an empty one, and will replace all other
49 # instances of "void" by "int".
50 #
51 # If your compiler has problems with "void *" only, compile with
52 # -DMAP_VOID_STAR. The unprototyper will replace "void *" by "char *",
53 # and will replace a (void) argument list by an empty one. All other
54 # instances of "void" will be left alone.
55 #
56 # If neither of these are defined, (void) argument lists will be replaced
57 # by empty ones.
58 #
59 # MAP   = -DMAP_VOID_STAR
60
61 # Now that we have brought up the subject of antique C compilers, here's
62 # a couple of aliases that may be useful, too.
63 #
64 # ALIAS = -Dstrchr=index
65
66 # If you need support for functions that implement ANSI-style variable
67 # length argument lists, edit the stdarg.h file provided with this
68 # package so that it contains the proper definitions for your machine.
69
70 ## END CONFIGURATION STUFF
71
72 SHELL   = /bin/sh
73
74 CFILES  = unproto.c tok_io.c tok_class.c tok_pool.c vstring.c symbol.c error.c \
75         hash.c strsave.c
76 HFILES  = error.h token.h vstring.h symbol.h
77 SCRIPTS = cpp.sh acc.sh
78 SAMPLES = stdarg.h stddef.h stdlib.h varargs.c example.c example.out
79 SOURCES = README $(CFILES) $(HFILES) Makefile $(SCRIPTS) $(SAMPLES)
80 FILES   = $(SOURCES) unproto.1
81 OBJECTS = tok_io.o tok_class.o tok_pool.o unproto.o vstring.o symbol.o error.o \
82         hash.o strsave.o
83
84 CFLAGS  = -O $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS)
85 #CFLAGS = -O $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -p -Dstatic=
86 #CFLAGS = -g $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -DDEBUG
87
88 $(PROG): $(OBJECTS)
89         $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(MALLOC)
90
91 # For linting, enable all bells and whistles.
92
93 lint:
94         lint -DPIPE_THROUGH_CPP=\"foo\" -DIGNORE_DIRECTIVES=\"foo\",\"bar\" \
95         $(BELL) -DMAP_VOID $(ALIAS) $(CFILES)
96
97 # Testing requires that the program is compiled with -DDEBUG.
98
99 test:   $(PROG) cpp example.c example.out
100         ./cpp example.c >example.tmp
101         @echo the following diff command should produce no output
102         diff -b example.out example.tmp
103         rm -f example.tmp
104
105 shar:   $(FILES)
106         @shar $(FILES)
107
108 archive:
109         $(ARCHIVE) $(SOURCES)
110
111 clean:
112         rm -f *.o core cpp unproto mon.out varargs.o varargs example.tmp
113
114 error.o : error.c token.h error.h Makefile
115 hash.o : hash.c Makefile
116 strsave.o : strsave.c error.h Makefile
117 symbol.o : symbol.c error.h token.h symbol.h Makefile
118 tok_class.o : tok_class.c error.h vstring.h token.h symbol.h Makefile
119 tok_io.o : tok_io.c token.h vstring.h error.h Makefile
120 tok_pool.o : tok_pool.c token.h vstring.h error.h Makefile
121 unproto.o : unproto.c vstring.h stdarg.h token.h error.h symbol.h Makefile
122 varargs.o : varargs.c stdarg.h Makefile
123 vstring.o : vstring.c vstring.h Makefile