]> git.saurik.com Git - apple/security.git/blame - SecuritySNACCRuntime/c-examples/any/makefile
Security-54.1.7.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c-examples / any / makefile
CommitLineData
bac41a7b
A
1# c-examples/any/makefile
2#
3# WARNING: this makefile isn't safe for parallel making!
4#
5# compile the any example
6#
7# MS 92
8#
a66d0d4a 9# $Header: /cvs/root/Security/SecuritySNACCRuntime/c-examples/any/Attic/makefile,v 1.1.1.1 2001/05/18 23:14:07 mb Exp $
bac41a7b
A
10# $Log: makefile,v $
11# Revision 1.1.1.1 2001/05/18 23:14:07 mb
12# Move from private repository to open source repository
13#
14# Revision 1.1.1.1 1999/03/16 18:06:08 aram
15# Originals from SMIME Free Library.
16#
17# Revision 1.6 1995/07/24 20:42:31 rj
18# useful.asn1 renamed to asn-useful.asn1 to accomodate to snacc's new file name generation scheme.
19# any-test.[hc] becomes any.[hc] due to to snacc's new file name generation scheme.
20#
21# `cd && make' instead of `cd; make'.
22#
23# changed `_' to `-' in file names.
24#
25# Revision 1.5 1995/02/20 11:51:39 rj
26# build snacc if it doesn't exist.
27# 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.
28#
29# Revision 1.4 1995/02/13 15:05:05 rj
30# augment CPPFLAGS, not overwrite.
31# use $(@D) and $(@F) instead of `dirname $@` and `basename $@` (not every system's got the commands).
32# we need the compiler for the dependencies, so make it if it doesn't yet exist.
33#
34# Revision 1.3 1994/08/31 21:41:37 rj
35# rebuild the executables when the c-lib is newer.
36#
37# Revision 1.2 1994/08/31 10:31:49 rj
38# since .o files get moved, a few more dependencies are needed.
39#
40# Revision 1.1 1994/08/31 08:46:20 rj
41# first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
42#
43
44include ../../makehead
45
46TOP = ../..
47
48ASN1_SRC_DIR = $(TOP)/asn1specs
49
50ASN1_C_LIB_DIR = $(TOP)/c-lib
51ASN1_C_INC_DIR = $(ASN1_C_LIB_DIR)/inc
52ASN1_C_LIB = $(ASN1_C_LIB_DIR)/libasn1csbuf.a
53
54COMPILERDIR = $(TOP)/compiler
55SNACC = $(COMPILERDIR)/snacc
56USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1
57SNACCFLAGS = -u $(USEFUL_TYPES)
58
59CPPFLAGS += -I$(TOP) -I$(ASN1_C_INC_DIR) -DUSE_SBUF $(LENFLAG)
60
61ASN1FILES = $(ASN1_SRC_DIR)/any.asn1
62
63# generated by snacc from any.asn1:
64ASN1HFILES = any.h
65ASN1CFILES = any.c
66
67CFILES = \
68 genber.c \
69 example.c
70
71DISTFILES = \
72 README \
73 makefile \
74 $(CFILES)
75
76#-------------------------------------------------------------------------------
77
78all:: genber def indef
79
80$(ASN1HFILES) \
81$(ASN1CFILES): $(SNACC) $(ASN1FILES)
82 $(REASON)
83 $(SNACC) $(SNACCFLAGS) $(ASN1FILES)
84
85$(SNACC):
86 cd $(@D) && $(MAKE) $(@F)
87
88def-obj \
89indef-obj:
90 mkdir $@
91
92def-obj/any.o \
93def-obj/example.o:
94 $(REASON)
95 $(MAKE) LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F)
96 mv $(@F) $@
97
98indef-obj/any.o \
99indef-obj/example.o:
100 $(REASON)
101 $(MAKE) LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F)
102 mv $(@F) $@
103
104genber: def-obj/any.o genber.o
105 $(REASON)
106 $(CC) $(LDFLAGS) -o $@ def-obj/any.o genber.o $(ASN1_C_LIB) $(LIBS)
107
108def: def-obj/any.o def-obj/example.o
109 $(REASON)
110 $(CC) $(LDFLAGS) -o $@ def-obj/any.o def-obj/example.o $(ASN1_C_LIB) $(LIBS)
111
112indef: indef-obj/any.o indef-obj/example.o
113 $(REASON)
114 $(CC) $(LDFLAGS) -o $@ indef-obj/any.o indef-obj/example.o $(ASN1_C_LIB) $(LIBS)
115
116genber \
117def \
118indef: $(ASN1_C_LIB)
119
120.PHONY: check
121
122check:: genber def indef
123 $(RM) foo.ber bar.ber
124 ./genber
125 ./indef att.ber > foo.ber
126 ./def foo.ber > bar.ber
127 @echo ''
128 @if cmp -s bar.ber att.ber; then\
129 echo "+++ Passed simple encode/decode tests using any.asn1.";\
130 else\
131 echo "--- Failed simple encode/decode tests using any.asn1.";\
132 fi
133 @echo ''
134 $(RM) foo.ber bar.ber
135
136clean::
137 $(RM) *.o *~ .emacs* core def indef genber att.ber $(ASN1HFILES) $(ASN1CFILES)
138 $(RM) -r def-obj indef-obj
139 $(RM) foo.ber bar.ber
140
141depend:: $(SNACC)
142
143include ../../maketail
144
145depend::
146 cp dependencies deps
147 for dir in def-obj indef-obj; do\
148 < dependencies sed -e 's:^\(.*\.o\):'"$$dir"'/\1:' >> deps;\
149 done
150 mv deps dependencies