Merge branch 'upstream-fixes' of git://lost.foo-projects.org/~ahkok/git/netdev-2...
[linux-2.6] / drivers / scsi / aic7xxx / aicasm / Makefile
1 PROG=   aicasm
2
3 .SUFFIXES= .l .y .c .h
4
5 CSRCS=  aicasm.c aicasm_symbol.c
6 YSRCS=  aicasm_gram.y aicasm_macro_gram.y
7 LSRCS=  aicasm_scan.l aicasm_macro_scan.l
8
9 GENHDRS=        aicdb.h $(YSRCS:.y=.h)
10 GENSRCS=        $(YSRCS:.y=.c) $(LSRCS:.l=.c)
11
12 SRCS=   ${CSRCS} ${GENSRCS}
13 LIBS=   -ldb
14 clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG)
15 # Override default kernel CFLAGS.  This is a userland app.
16 AICASM_CFLAGS:= -I/usr/include -I.
17 LEX= flex
18 YACC= bison
19 YFLAGS= -d
20
21 NOMAN=  noman
22
23 ifneq ($(HOSTCC),)
24 AICASM_CC= $(HOSTCC)
25 else
26 AICASM_CC= $(CC)
27 endif
28
29 ifdef DEBUG
30 CFLAGS+= -DDEBUG -g
31 YFLAGS+= -t -v
32 LFLAGS= -d
33 endif
34
35 $(PROG):  ${GENHDRS} $(SRCS)
36         $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) $(LIBS)
37
38 aicdb.h:
39         @if [ -e "/usr/include/db4/db_185.h" ]; then            \
40                 echo "#include <db4/db_185.h>" > aicdb.h;       \
41          elif [ -e "/usr/include/db3/db_185.h" ]; then          \
42                 echo "#include <db3/db_185.h>" > aicdb.h;       \
43          elif [ -e "/usr/include/db2/db_185.h" ]; then          \
44                 echo "#include <db2/db_185.h>" > aicdb.h;       \
45          elif [ -e "/usr/include/db1/db_185.h" ]; then          \
46                 echo "#include <db1/db_185.h>" > aicdb.h;       \
47          elif [ -e "/usr/include/db/db_185.h" ]; then           \
48                 echo "#include <db/db_185.h>" > aicdb.h;        \
49          elif [ -e "/usr/include/db_185.h" ]; then              \
50                 echo "#include <db_185.h>" > aicdb.h;           \
51          else                                                   \
52                 echo "*** Install db development libraries";    \
53          fi
54
55 clean:
56         rm -f $(clean-files)
57
58 # Create a dependency chain in generated files
59 # to avoid concurrent invocations of the single
60 # rule that builds them all.
61 aicasm_gram.c: aicasm_gram.h
62 aicasm_gram.c aicasm_gram.h: aicasm_gram.y
63         $(YACC) $(YFLAGS) -b $(<:.y=) $<
64         mv $(<:.y=).tab.c $(<:.y=.c)
65         mv $(<:.y=).tab.h $(<:.y=.h)
66
67 # Create a dependency chain in generated files
68 # to avoid concurrent invocations of the single
69 # rule that builds them all.
70 aicasm_macro_gram.c: aicasm_macro_gram.h
71 aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y
72         $(YACC) $(YFLAGS) -b $(<:.y=) -p mm $<
73         mv $(<:.y=).tab.c $(<:.y=.c)
74         mv $(<:.y=).tab.h $(<:.y=.h)
75
76 aicasm_scan.c: aicasm_scan.l
77         $(LEX) $(LFLAGS) -o$@ $<
78
79 aicasm_macro_scan.c: aicasm_macro_scan.l
80         $(LEX) $(LFLAGS) -Pmm -o$@ $<