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