# c-examples/any/makefile # # WARNING: this makefile isn't safe for parallel making! # # compile the any example # # MS 92 # # $Header: /cvs/Darwin/src/live/Security/SecuritySNACCRuntime/c-examples/any/makefile,v 1.1.1.1 2001/05/18 23:14:07 mb Exp $ # $Log: makefile,v $ # Revision 1.1.1.1 2001/05/18 23:14:07 mb # Move from private repository to open source repository # # Revision 1.1.1.1 1999/03/16 18:06:08 aram # Originals from SMIME Free Library. # # Revision 1.6 1995/07/24 20:42:31 rj # useful.asn1 renamed to asn-useful.asn1 to accomodate to snacc's new file name generation scheme. # any-test.[hc] becomes any.[hc] due to to snacc's new file name generation scheme. # # `cd && make' instead of `cd; make'. # # changed `_' to `-' in file names. # # Revision 1.5 1995/02/20 11:51:39 rj # build snacc if it doesn't exist. # 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. # # Revision 1.4 1995/02/13 15:05:05 rj # augment CPPFLAGS, not overwrite. # use $(@D) and $(@F) instead of `dirname $@` and `basename $@` (not every system's got the commands). # we need the compiler for the dependencies, so make it if it doesn't yet exist. # # Revision 1.3 1994/08/31 21:41:37 rj # rebuild the executables when the c-lib is newer. # # Revision 1.2 1994/08/31 10:31:49 rj # since .o files get moved, a few more dependencies are needed. # # Revision 1.1 1994/08/31 08:46:20 rj # first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog. # include ../../makehead TOP = ../.. ASN1_SRC_DIR = $(TOP)/asn1specs ASN1_C_LIB_DIR = $(TOP)/c-lib ASN1_C_INC_DIR = $(ASN1_C_LIB_DIR)/inc ASN1_C_LIB = $(ASN1_C_LIB_DIR)/libasn1csbuf.a COMPILERDIR = $(TOP)/compiler SNACC = $(COMPILERDIR)/snacc USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1 SNACCFLAGS = -u $(USEFUL_TYPES) CPPFLAGS += -I$(TOP) -I$(ASN1_C_INC_DIR) -DUSE_SBUF $(LENFLAG) ASN1FILES = $(ASN1_SRC_DIR)/any.asn1 # generated by snacc from any.asn1: ASN1HFILES = any.h ASN1CFILES = any.c CFILES = \ genber.c \ example.c DISTFILES = \ README \ makefile \ $(CFILES) #------------------------------------------------------------------------------- all:: genber def indef $(ASN1HFILES) \ $(ASN1CFILES): $(SNACC) $(ASN1FILES) $(REASON) $(SNACC) $(SNACCFLAGS) $(ASN1FILES) $(SNACC): cd $(@D) && $(MAKE) $(@F) def-obj \ indef-obj: mkdir $@ def-obj/any.o \ def-obj/example.o: $(REASON) $(MAKE) LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F) mv $(@F) $@ indef-obj/any.o \ indef-obj/example.o: $(REASON) $(MAKE) LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F) mv $(@F) $@ genber: def-obj/any.o genber.o $(REASON) $(CC) $(LDFLAGS) -o $@ def-obj/any.o genber.o $(ASN1_C_LIB) $(LIBS) def: def-obj/any.o def-obj/example.o $(REASON) $(CC) $(LDFLAGS) -o $@ def-obj/any.o def-obj/example.o $(ASN1_C_LIB) $(LIBS) indef: indef-obj/any.o indef-obj/example.o $(REASON) $(CC) $(LDFLAGS) -o $@ indef-obj/any.o indef-obj/example.o $(ASN1_C_LIB) $(LIBS) genber \ def \ indef: $(ASN1_C_LIB) .PHONY: check check:: genber def indef $(RM) foo.ber bar.ber ./genber ./indef att.ber > foo.ber ./def foo.ber > bar.ber @echo '' @if cmp -s bar.ber att.ber; then\ echo "+++ Passed simple encode/decode tests using any.asn1.";\ else\ echo "--- Failed simple encode/decode tests using any.asn1.";\ fi @echo '' $(RM) foo.ber bar.ber clean:: $(RM) *.o *~ .emacs* core def indef genber att.ber $(ASN1HFILES) $(ASN1CFILES) $(RM) -r def-obj indef-obj $(RM) foo.ber bar.ber depend:: $(SNACC) include ../../maketail depend:: cp dependencies deps for dir in def-obj indef-obj; do\ < dependencies sed -e 's:^\(.*\.o\):'"$$dir"'/\1:' >> deps;\ done mv deps dependencies