scsi: aic7xxx: fix firmware build with O=path

Building firmware with O=path was apparently broken in aic7 for ever.
Message of the previous commit to the Makefile (from 2008) mentions this
unfortunate state of affairs already.  Fix this, mostly to make
randconfig builds more reliable.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Jakub Kicinski 2017-07-18 18:58:34 -07:00 committed by Martin K. Petersen
parent 70c54e210e
commit 516b7db593
2 changed files with 35 additions and 30 deletions

View File

@ -55,9 +55,9 @@ aicasm-7xxx-opts-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) := \
ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y) ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
$(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm $(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
$(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic7xxx_reg.h \ $(obj)/aicasm/aicasm -I$(srctree)/$(src) -r $(obj)/aic7xxx_reg.h \
$(aicasm-7xxx-opts-y) -o $(obj)/aic7xxx_seq.h \ $(aicasm-7xxx-opts-y) -o $(obj)/aic7xxx_seq.h \
$(src)/aic7xxx.seq $(srctree)/$(src)/aic7xxx.seq
$(aic7xxx-gen-y): $(obj)/aic7xxx_seq.h $(aic7xxx-gen-y): $(obj)/aic7xxx_seq.h
else else
@ -72,14 +72,14 @@ aicasm-79xx-opts-$(CONFIG_AIC79XX_REG_PRETTY_PRINT) := \
ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y) ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y)
$(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm $(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm
$(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h \ $(obj)/aicasm/aicasm -I$(srctree)/$(src) -r $(obj)/aic79xx_reg.h \
$(aicasm-79xx-opts-y) -o $(obj)/aic79xx_seq.h \ $(aicasm-79xx-opts-y) -o $(obj)/aic79xx_seq.h \
$(src)/aic79xx.seq $(srctree)/$(src)/aic79xx.seq
$(aic79xx-gen-y): $(obj)/aic79xx_seq.h $(aic79xx-gen-y): $(obj)/aic79xx_seq.h
else else
$(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped $(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped
endif endif
$(obj)/aicasm/aicasm: $(src)/aicasm/*.[chyl] $(obj)/aicasm/aicasm: $(srctree)/$(src)/aicasm/*.[chyl]
$(MAKE) -C $(src)/aicasm $(MAKE) -C $(srctree)/$(src)/aicasm OUTDIR=$(shell pwd)/$(obj)/aicasm/

View File

@ -1,19 +1,21 @@
PROG= aicasm PROG= aicasm
OUTDIR ?= ./
.SUFFIXES= .l .y .c .h .SUFFIXES= .l .y .c .h
CSRCS= aicasm.c aicasm_symbol.c CSRCS= aicasm.c aicasm_symbol.c
YSRCS= aicasm_gram.y aicasm_macro_gram.y YSRCS= aicasm_gram.y aicasm_macro_gram.y
LSRCS= aicasm_scan.l aicasm_macro_scan.l LSRCS= aicasm_scan.l aicasm_macro_scan.l
GENHDRS= aicdb.h $(YSRCS:.y=.h) GENHDRS= $(addprefix ${OUTDIR}/,aicdb.h $(YSRCS:.y=.h))
GENSRCS= $(YSRCS:.y=.c) $(LSRCS:.l=.c) GENSRCS= $(addprefix ${OUTDIR}/,$(YSRCS:.y=.c) $(LSRCS:.l=.c))
SRCS= ${CSRCS} ${GENSRCS} SRCS= ${CSRCS} ${GENSRCS}
LIBS= -ldb LIBS= -ldb
clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG) clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG)
# Override default kernel CFLAGS. This is a userland app. # Override default kernel CFLAGS. This is a userland app.
AICASM_CFLAGS:= -I/usr/include -I. AICASM_CFLAGS:= -I/usr/include -I. -I$(OUTDIR)
LEX= flex LEX= flex
YACC= bison YACC= bison
YFLAGS= -d YFLAGS= -d
@ -32,22 +34,25 @@ YFLAGS+= -t -v
LFLAGS= -d LFLAGS= -d
endif endif
$(PROG): ${GENHDRS} $(SRCS) $(PROG): $(OUTDIR) ${GENHDRS} $(SRCS)
$(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) $(LIBS) $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(OUTDIR)/$(PROG) $(LIBS)
aicdb.h: $(OUTDIR):
mkdir -p $(OUTDIR)
$(OUTDIR)/aicdb.h:
@if [ -e "/usr/include/db4/db_185.h" ]; then \ @if [ -e "/usr/include/db4/db_185.h" ]; then \
echo "#include <db4/db_185.h>" > aicdb.h; \ echo "#include <db4/db_185.h>" > $@; \
elif [ -e "/usr/include/db3/db_185.h" ]; then \ elif [ -e "/usr/include/db3/db_185.h" ]; then \
echo "#include <db3/db_185.h>" > aicdb.h; \ echo "#include <db3/db_185.h>" > $@; \
elif [ -e "/usr/include/db2/db_185.h" ]; then \ elif [ -e "/usr/include/db2/db_185.h" ]; then \
echo "#include <db2/db_185.h>" > aicdb.h; \ echo "#include <db2/db_185.h>" > $@; \
elif [ -e "/usr/include/db1/db_185.h" ]; then \ elif [ -e "/usr/include/db1/db_185.h" ]; then \
echo "#include <db1/db_185.h>" > aicdb.h; \ echo "#include <db1/db_185.h>" > $@; \
elif [ -e "/usr/include/db/db_185.h" ]; then \ elif [ -e "/usr/include/db/db_185.h" ]; then \
echo "#include <db/db_185.h>" > aicdb.h; \ echo "#include <db/db_185.h>" > $@; \
elif [ -e "/usr/include/db_185.h" ]; then \ elif [ -e "/usr/include/db_185.h" ]; then \
echo "#include <db_185.h>" > aicdb.h; \ echo "#include <db_185.h>" > $@; \
else \ else \
echo "*** Install db development libraries"; \ echo "*** Install db development libraries"; \
fi fi
@ -58,23 +63,23 @@ clean:
# Create a dependency chain in generated files # Create a dependency chain in generated files
# to avoid concurrent invocations of the single # to avoid concurrent invocations of the single
# rule that builds them all. # rule that builds them all.
aicasm_gram.c: aicasm_gram.h $(OUTDIR)/aicasm_gram.c: $(OUTDIR)/aicasm_gram.h
aicasm_gram.c aicasm_gram.h: aicasm_gram.y $(OUTDIR)/aicasm_gram.c $(OUTDIR)/aicasm_gram.h: aicasm_gram.y
$(YACC) $(YFLAGS) -b $(<:.y=) $< $(YACC) $(YFLAGS) -b $(<:.y=) $<
mv $(<:.y=).tab.c $(<:.y=.c) mv $(<:.y=).tab.c $(OUTDIR)/$(<:.y=.c)
mv $(<:.y=).tab.h $(<:.y=.h) mv $(<:.y=).tab.h $(OUTDIR)/$(<:.y=.h)
# Create a dependency chain in generated files # Create a dependency chain in generated files
# to avoid concurrent invocations of the single # to avoid concurrent invocations of the single
# rule that builds them all. # rule that builds them all.
aicasm_macro_gram.c: aicasm_macro_gram.h $(OUTDIR)/aicasm_macro_gram.c: $(OUTDIR)/aicasm_macro_gram.h
aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y $(OUTDIR)/aicasm_macro_gram.c $(OUTDIR)/aicasm_macro_gram.h: aicasm_macro_gram.y
$(YACC) $(YFLAGS) -b $(<:.y=) -p mm $< $(YACC) $(YFLAGS) -b $(<:.y=) -p mm $<
mv $(<:.y=).tab.c $(<:.y=.c) mv $(<:.y=).tab.c $(OUTDIR)/$(<:.y=.c)
mv $(<:.y=).tab.h $(<:.y=.h) mv $(<:.y=).tab.h $(OUTDIR)/$(<:.y=.h)
aicasm_scan.c: aicasm_scan.l $(OUTDIR)/aicasm_scan.c: aicasm_scan.l
$(LEX) $(LFLAGS) -o$@ $< $(LEX) $(LFLAGS) -o $@ $<
aicasm_macro_scan.c: aicasm_macro_scan.l $(OUTDIR)/aicasm_macro_scan.c: aicasm_macro_scan.l
$(LEX) $(LFLAGS) -Pmm -o$@ $< $(LEX) $(LFLAGS) -Pmm -o $@ $<