1 #
2 # MAF primary makefile
3 #
4 # Copyright 2013, Momentum Data Systems, Inc. All rights reserved.
5 #
7 # Pertinent targets:
8 #
9 # dae Prepare SDK Supplement for DEMO=Xsdk.
10 #
11 # Pertinent demonstrations (DEMO=):
12 #
13 # mx1sdk SDK for basic framework.
14 #
16 DATE= `date +%y%m%d`
17 CONFIG= None
19 CC= gcc
20 CFLAGS= -g -O -I../../f/s2 -I../../te/s2 -I../../include -L../../bin
21 LDFLAGS= -lcint
22 DOSFLAGS= -mno-cygwin
24 SUPBASE=$(patsubst mx1sdk%,mx1sdk,$(patsubst mt1sdk%,mt1sdk,$(patsubst mx3sdk%,mx3sdk,$(patsubst mt3sdk%,mt3sdk,$(DEMO)))))
26 # External build targets
28 dae:
29 makedae `pwd | sed 's|/cygdrive/[a-z]*/||'` $(CONFIG) $(DEMO)
30 mv $(DEMO).zip $(DEMO)_$(DATE).zip
32 force:
34 %.hdM: force
35 @gcc -undef -nostdinc -E -P -I$(dir $@) -dD $*.h >$@.a
36 @awk -F' ' '/^#define/ { if ($$2 !~ /[()]/ && ($$2 ~ /^read/ || $$2 ~ /^wr[io]te/ || $$2 ~ /^exec/) && $$3 != "") print "alpha", $$2 }' $@.a >$@.b
37 @cat $@.a $@.b >$@.c
38 @gcc -undef -nostdinc -E $@.c | $(dir $@)../pyalpha/bin/itox -i -S | $(dir $@)../pyalpha/bin/xtoi -S >$@.d
39 @if grep -v ^alph[ab] >/dev/null 2>&1 $@.d; then false; fi
40 @grep ^alpha $@.c >$@.e
41 @awk -F' ' '{ symbol=$$2; getline <values; value=$$2; if (! (value in store)) { print "#define", symbol, value; store[value] = symbol } }' values=$@.d $@.e >$@.f
42 @if [ `cat $@.d | wc -l` != `cat $@.e | wc -l` ] ; then \
43 echo 1>&2 "error producing $@"; \
44 rm $@; \
45 exit 1; \
46 fi
47 @(echo "// $(notdir $@): inverse compilation file [`date`]"; \
48 echo; \
49 cat $@.f) >$@
50 @rm $@.[abcdef]
52 # EOF