]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/c++-examples/any/makefile
a9e45b915fda4f4434e17367e2d995e8197b3beb
[apple/security.git] / SecuritySNACCRuntime / c++-examples / any / makefile
1 # c++-examples/any/makefile
2 #
3 # WARNING: this makefile isn't safe for parallel making!
4 #
5 # builds the C++ ANY example
6 #
7 # MS 92
8 #
9 # $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/c++-examples/any/makefile,v 1.1.1.1 2001/05/18 23:14:05 mb Exp $
10 # $Log: makefile,v $
11 # Revision 1.1.1.1 2001/05/18 23:14:05 mb
12 # Move from private repository to open source repository
13 #
14 # Revision 1.3 2000/12/22 00:03:01 dmitch
15 # Misc. updates for clean build on Cheetah 1D7.
16 #
17 # Revision 1.2 2000/06/08 19:58:44 dmitch
18 # Mods for X port.
19 #
20 # Revision 1.1.1.1 1999/03/16 18:05:57 aram
21 # Originals from SMIME Free Library.
22 #
23 # Revision 1.9 1997/02/16 16:47:46 rj
24 # made return *this after calling abort()'' a compile time option.
25 #
26 # Revision 1.8 1995/07/24 15:29:07 rj
27 # useful.asn1 renamed to asn-useful.asn1 to accomodate to snacc's new file name generation scheme.
28 # any-test.[hC] becomes any.[hC] due to to snacc's new file name generation scheme.
29 #
30 # `cd && make' instead of `cd; make'.
31 #
32 # changed `_' to `-' in file names.
33 #
34 # Revision 1.7 1995/02/20 11:46:19 rj
35 # build snacc if it doesn't exist.
36 # 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.
37 #
38 # Revision 1.6 1995/02/13 14:58:12 rj
39 # augment CPPFLAGS, not overwrite
40 #
41 # Revision 1.5 1994/10/08 04:35:42 rj
42 # enhance portability by using standard make capabilities instead of utilies (basename, dirname) not found on every platform.
43 #
44 # for the dependencies, generate the snacc compiler if it doesn't exist.
45 #
46 # Revision 1.4 1994/09/01 02:26:53 rj
47 # use CXX instead of CC to get another default linkage
48 #
49 # Revision 1.3 1994/08/31 21:38:34 rj
50 # rebuild the executables when the c++-lib is newer.
51 #
52 # Revision 1.2 1994/08/31 10:31:47 rj
53 # since .o files get moved, a few more dependencies are needed.
54 #
55 # Revision 1.1 1994/08/31 08:48:03 rj
56 # first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
57 #
58
59 include ../../makehead
60
61 TOP = ../..
62
63 ASN1_SRC_DIR = $(TOP)/asn1specs
64
65 ASN1_C++_LIB_DIR = $(TOP)/c++-lib
66 BUILD_DIR = /Data_and_Apps/dmitchBuild
67 ASN1_C++_INC_DIR = $(ASN1_C++_LIB_DIR)/inc
68 ASN1_C++_LIB = $(ASN1_C++_LIB_DIR)/libasn1c++.a -framework cdsa_utilities -F/System/Library/PrivateFrameworks
69 #ASN1_C++_LIB = $(BUILD_DIR)/libsnacc++.a
70 #ASN1_C++_LIB = -framework snaccRuntime -F/Data_and_Apps/dmitchBuild -lstdc++
71
72 COMPILERDIR = $(TOP)/compiler
73 SNACC = $(COMPILERDIR)/snacc
74 USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1
75 SNACCFLAGS = -C $(SNACC_NOVOLAT) -u $(USEFUL_TYPES)
76
77 CC = $(CXX)
78 CPPFLAGS += -I$(TOP) -I$(ASN1_C++_INC_DIR) $(LENFLAG) -DVDADER_RULES -F/System/Library/PrivateFrameworks
79
80 ASN1FILES = $(ASN1_SRC_DIR)/any.asn1
81
82 # generated by snacc from any.asn1:
83 ASN1HFILES = any.h
84 ASN1CFILES = any.cpp
85
86 CFILES = \
87 genber.C \
88 example.C
89
90 DISTFILES = \
91 README \
92 makefile \
93 $(CFILES)
94
95 #-------------------------------------------------------------------------------
96
97 all:: genber def indef
98
99 $(ASN1HFILES) \
100 $(ASN1CFILES): $(SNACC) $(ASN1FILES)
101 $(REASON)
102 $(SNACC) $(SNACCFLAGS) $(ASN1FILES)
103
104 $(SNACC):
105 cd $(@D) && $(MAKE) $(@F)
106
107 def-obj \
108 indef-obj:
109 mkdir $@
110
111 def-obj/any.o \
112 def-obj/example.o:
113 $(REASON)
114 $(MAKE) LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F)
115 mv $(@F) $@
116
117 indef-obj/any.o \
118 indef-obj/example.o:
119 $(REASON)
120 $(MAKE) LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F)
121 mv $(@F) $@
122
123 genber: def-obj/any.o genber.o
124 $(REASON)
125 $(CC) $(LDFLAGS) -o $@ def-obj/any.o genber.o $(ASN1_C++_LIB) $(LIBS) -lstdc++
126
127 def: def-obj/any.o def-obj/example.o
128 $(REASON)
129 $(CC) $(LDFLAGS) -o $@ def-obj/any.o def-obj/example.o $(ASN1_C++_LIB) $(LIBS) -lstdc++
130
131 indef: indef-obj/any.o indef-obj/example.o
132 $(REASON)
133 $(CC) $(LDFLAGS) -o $@ indef-obj/any.o indef-obj/example.o $(ASN1_C++_LIB) $(LIBS) -lstdc++
134
135 genber \
136 def \
137 indef:
138
139 .PHONY: check
140
141 check:: genber def indef
142 $(RM) foo.ber bar.ber
143 ./genber
144 ./indef att.ber > foo.ber
145 ./def foo.ber > bar.ber
146 @echo ''
147 @if cmp -s bar.ber att.ber; then\
148 echo "+++ Passed simple encode/decode tests using any.asn1.";\
149 else\
150 echo "--- Failed simple encode/decode tests using any.asn1.";\
151 fi
152 @echo ''
153 $(RM) foo.ber bar.ber
154
155 clean::
156 $(RM) *.o *~ .emacs* core def indef genber att.ber $(ASN1HFILES) $(ASN1CFILES)
157 $(RM) -r def-obj indef-obj
158 $(RM) foo.ber bar.ber
159
160 depend:: $(SNACC)
161
162 include ../../maketail
163
164 depend::
165 cp dependencies deps
166 for dir in def-obj indef-obj; do\
167 < dependencies sed -e 's:^\(.*\.o\):'"$$dir"'/\1:' >> deps;\
168 done
169 mv deps dependencies