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