]>
Commit | Line | Data |
---|---|---|
bac41a7b A |
1 | # file: c-examples/simple/makefile |
2 | # | |
3 | # WARNING: this makefile isn't safe for parallel making! | |
4 | # | |
a66d0d4a | 5 | # $Header: /cvs/root/Security/SecuritySNACCRuntime/c-examples/simple/Attic/makefile,v 1.1.1.1 2001/05/18 23:14:07 mb Exp $ |
bac41a7b A |
6 | # $Log: makefile,v $ |
7 | # Revision 1.1.1.1 2001/05/18 23:14:07 mb | |
8 | # Move from private repository to open source repository | |
9 | # | |
10 | # Revision 1.1.1.1 1999/03/16 18:06:08 aram | |
11 | # Originals from SMIME Free Library. | |
12 | # | |
13 | # Revision 1.6 1995/07/24 20:46:17 rj | |
14 | # useful.asn1 renamed to asn-useful.asn1 to accomodate to snacc's new file name generation scheme. | |
15 | # | |
16 | # `cd && make' instead of `cd; make'. | |
17 | # | |
18 | # changed `_' to `-' in file names. | |
19 | # | |
20 | # Revision 1.5 1995/02/20 11:50:49 rj | |
21 | # build snacc if it doesn't exist. | |
22 | # some makes leave a trailing slash on $(@D), others don't. this causes some mkdir(1)s to deny their cooperation. therefore, the slash has got to be stripped. | |
23 | # | |
24 | # Revision 1.4 1995/02/13 15:05:36 rj | |
25 | # augment CPPFLAGS, not overwrite. | |
26 | # use $(@D) and $(@F) instead of `dirname $@` and `basename $@` (not every system's got the commands). | |
27 | # we need the compiler for the dependencies, so make it if it doesn't yet exist. | |
28 | # | |
29 | # Revision 1.3 1994/08/31 21:42:52 rj | |
30 | # rebuild the executables when the c-lib they get linked against is newer. | |
31 | # the file good-pr.ber needs to be distributed. | |
32 | # | |
33 | # Revision 1.2 1994/08/31 10:31:52 rj | |
34 | # since .o files get moved, a few more dependencies are needed. | |
35 | # | |
36 | # Revision 1.1 1994/08/31 08:46:27 rj | |
37 | # first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog. | |
38 | # | |
39 | ||
40 | include ../../makehead | |
41 | ||
42 | TOP = ../.. | |
43 | ||
44 | ASN1_SRC_DIR = $(TOP)/asn1specs | |
45 | ||
46 | ASN1_C_LIB_DIR = $(TOP)/c-lib | |
47 | ASN1_C_INC_DIR = $(ASN1_C_LIB_DIR)/inc | |
48 | MBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1cmbuf.a | |
49 | SBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1csbuf.a | |
50 | EBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1cebuf.a | |
51 | ||
52 | COMPILERDIR = $(TOP)/compiler | |
53 | SNACC = $(COMPILERDIR)/snacc | |
54 | USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1 | |
55 | SNACCFLAGS = -u $(USEFUL_TYPES) | |
56 | ||
57 | CPPFLAGS += -I$(TOP) -I$(ASN1_C_INC_DIR) $(BUFFLAG) $(LENFLAG) | |
58 | ||
59 | ASN1FILES = $(ASN1_SRC_DIR)/p-rec.asn1 | |
60 | # generated by snacc from p-rec.asn1: | |
61 | ASN1HFILES = p-rec.h | |
62 | ASN1CFILES = p-rec.c | |
63 | ||
64 | CFILES = \ | |
65 | genber.c \ | |
66 | minbuf-ex.c \ | |
67 | expbuf-ex.c \ | |
68 | sbuf-ex.c | |
69 | ||
70 | BUFFLAG = -DUSE_SBUF | |
71 | ||
72 | DISTFILES = \ | |
73 | README \ | |
74 | makefile \ | |
75 | $(CFILES) \ | |
76 | good-pr.ber | |
77 | ||
78 | #------------------------------------------------------------------------------- | |
79 | ||
80 | all:: genber minbuf-def minbuf-indef expbuf-def expbuf-indef sbuf-def sbuf-indef | |
81 | ||
82 | $(ASN1HFILES) \ | |
83 | $(ASN1CFILES): $(SNACC) $(ASN1FILES) | |
84 | $(REASON) | |
85 | $(SNACC) $(SNACCFLAGS) $(ASN1FILES) | |
86 | ||
87 | $(SNACC): | |
88 | cd $(@D) && $(MAKE) $(@F) | |
89 | ||
90 | min-def-obj \ | |
91 | min-indef-obj \ | |
92 | exp-def-obj \ | |
93 | exp-indef-obj \ | |
94 | s-def-obj \ | |
95 | s-indef-obj: | |
96 | mkdir $@ | |
97 | ||
98 | min-def-obj/p-rec.o \ | |
99 | min-def-obj/minbuf-ex.o: | |
100 | $(REASON) | |
101 | $(MAKE) BUFFLAG=-DUSE_MIN_BUF LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F) | |
102 | mv $(@F) $@ | |
103 | ||
104 | min-indef-obj/p-rec.o \ | |
105 | min-indef-obj/minbuf-ex.o: | |
106 | $(REASON) | |
107 | $(MAKE) BUFFLAG=-DUSE_MIN_BUF LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F) | |
108 | mv $(@F) $@ | |
109 | ||
110 | exp-def-obj/p-rec.o \ | |
111 | exp-def-obj/expbuf-ex.o: | |
112 | $(REASON) | |
113 | $(MAKE) BUFFLAG=-DUSE_EXP_BUF LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F) | |
114 | mv $(@F) $@ | |
115 | ||
116 | exp-indef-obj/p-rec.o \ | |
117 | exp-indef-obj/expbuf-ex.o: | |
118 | $(REASON) | |
119 | $(MAKE) BUFFLAG=-DUSE_EXP_BUF LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F) | |
120 | mv $(@F) $@ | |
121 | ||
122 | s-def-obj/p-rec.o \ | |
123 | s-def-obj/sbuf-ex.o: | |
124 | $(REASON) | |
125 | $(MAKE) LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F) | |
126 | mv $(@F) $@ | |
127 | ||
128 | s-indef-obj/p-rec.o \ | |
129 | s-indef-obj/sbuf-ex.o: | |
130 | $(REASON) | |
131 | $(MAKE) LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F) | |
132 | mv $(@F) $@ | |
133 | ||
134 | genber: s-def-obj/p-rec.o genber.o | |
135 | $(REASON) | |
136 | $(CC) $(LDFLAGS) -o $@ s-def-obj/p-rec.o genber.o $(SBUF_ASN1_LIB) $(LIBS) | |
137 | ||
138 | minbuf-def: min-def-obj/p-rec.o min-def-obj/minbuf-ex.o | |
139 | $(REASON) | |
140 | $(CC) $(LDFLAGS) -o $@ min-def-obj/p-rec.o min-def-obj/minbuf-ex.o $(MBUF_ASN1_LIB) $(LIBS) | |
141 | ||
142 | minbuf-indef: min-indef-obj/p-rec.o min-indef-obj/minbuf-ex.o | |
143 | $(REASON) | |
144 | $(CC) $(LDFLAGS) -o $@ min-indef-obj/p-rec.o min-indef-obj/minbuf-ex.o $(MBUF_ASN1_LIB) $(LIBS) | |
145 | ||
146 | expbuf-def: exp-def-obj/p-rec.o exp-def-obj/expbuf-ex.o | |
147 | $(REASON) | |
148 | $(CC) $(LDFLAGS) -o $@ exp-def-obj/p-rec.o exp-def-obj/expbuf-ex.o $(EBUF_ASN1_LIB) $(LIBS) | |
149 | ||
150 | expbuf-indef: exp-indef-obj/p-rec.o exp-indef-obj/expbuf-ex.o | |
151 | $(REASON) | |
152 | $(CC) $(LDFLAGS) -o $@ exp-indef-obj/p-rec.o exp-indef-obj/expbuf-ex.o $(EBUF_ASN1_LIB) $(LIBS) | |
153 | ||
154 | sbuf-def: s-def-obj/p-rec.o s-def-obj/sbuf-ex.o | |
155 | $(REASON) | |
156 | $(CC) $(LDFLAGS) -o $@ s-def-obj/p-rec.o s-def-obj/sbuf-ex.o $(SBUF_ASN1_LIB) $(LIBS) | |
157 | ||
158 | sbuf-indef: s-indef-obj/p-rec.o s-indef-obj/sbuf-ex.o | |
159 | $(REASON) | |
160 | $(CC) $(LDFLAGS) -o $@ s-indef-obj/p-rec.o s-indef-obj/sbuf-ex.o $(SBUF_ASN1_LIB) $(LIBS) | |
161 | ||
162 | genber \ | |
163 | sbuf-def \ | |
164 | sbuf-indef: $(SBUF_ASN1_LIB) | |
165 | ||
166 | minbuf-def \ | |
167 | minbuf-indef: $(MINBUF_ASN1_LIB) | |
168 | ||
169 | expbuf-def \ | |
170 | expbuf-indef: $(EXPBUF_ASN1_LIB) | |
171 | ||
172 | .PHONY: check | |
173 | ||
174 | check:: minbuf-def minbuf-indef expbuf-def expbuf-indef sbuf-def sbuf-indef | |
175 | for bt in min exp s; do\ | |
176 | $(RM) $$bt-foo.ber $$bt-bar.ber;\ | |
177 | ./$${bt}buf-indef good-pr.ber > $$bt-foo.ber;\ | |
178 | ./$${bt}buf-def $$bt-foo.ber > $$bt-bar.ber;\ | |
179 | done | |
180 | @for bt in min exp s; do\ | |
181 | if cmp -s $$bt-bar.ber good-pr.ber; then\ | |
182 | echo "+++ Passed simple encode/decode tests using p-rec.asn1 with $${bt}bufs.";\ | |
183 | else\ | |
184 | echo "--- Failed simple encode/decode tests using p-rec.asn1 with $${bt}bufs.";\ | |
185 | fi;\ | |
186 | $(RM) $$bt-foo.ber $$bt-bar.ber;\ | |
187 | done | |
188 | ||
189 | clean:: | |
190 | $(RM) *.o *~ core .emacs* | |
191 | $(RM) expbuf-def expbuf-indef sbuf-indef sbuf-def minbuf-def minbuf-indef genber pr.ber $(ASN1HFILES) $(ASN1CFILES) | |
192 | $(RM) -r *-def-obj *-indef-obj | |
193 | $(RM) *-foo.ber *-bar.ber | |
194 | ||
195 | depend:: $(SNACC) | |
196 | ||
197 | include ../../maketail | |
198 | ||
199 | depend:: | |
200 | cp dependencies deps | |
201 | for dir in min-def-obj min-indef-obj exp-def-obj exp-indef-obj s-def-obj s-indef-obj; do\ | |
202 | < dependencies sed -e 's:^\(.*\.o\):'"$$dir"'/\1:' >> deps;\ | |
203 | done | |
204 | mv deps dependencies |