1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
# c-examples/any/makefile
#
# WARNING: this makefile isn't safe for parallel making!
#
# compile the any example
#
# MS 92
#
# $Header: /usr/app/odstb/CVS/snacc/c-examples/any/makefile,v 1.6 1995/07/24 20:42:31 rj Exp $
# $Log: makefile,v $
# 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 = /usr
ASN1_SRC_DIR = $(TOP)/include/snacc/asn1
ASN1_C_LIB_DIR = $(TOP)/lib
ASN1_C_INC_DIR = $(TOP)/include/snacc/c
ASN1_C_LIB = $(ASN1_C_LIB_DIR)/libasn1csbuf.a
COMPILERDIR = $(TOP)/bin
SNACC = $(COMPILERDIR)/snacc
USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1
SNACCFLAGS = -u $(USEFUL_TYPES)
CPPFLAGS += -g -I$(TOP) -I$(ASN1_C_INC_DIR) -DUSE_SBUF $(LENFLAG)
LIBS += -lm
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
|