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