From patchwork Fri Feb 12 22:42:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Bottomley X-Patchwork-Id: 8298331 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3BB309F1E0 for ; Fri, 12 Feb 2016 22:42:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1FAA12041E for ; Fri, 12 Feb 2016 22:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECF6C2041B for ; Fri, 12 Feb 2016 22:42:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751451AbcBLWme (ORCPT ); Fri, 12 Feb 2016 17:42:34 -0500 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:47686 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750904AbcBLWmd (ORCPT ); Fri, 12 Feb 2016 17:42:33 -0500 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 95D768EE26D; Fri, 12 Feb 2016 14:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1455316952; bh=IeN0hftWR+MPIp41kKJtk064lBHJoyxITLxbPAcNR2k=; h=Subject:From:To:Cc:Date:From; b=Xf5MAC2IUQSaXX9dcwjbfyb+flCFDIgcYYa8InUho3/MmzZF0aioVOU7rj8jfpgpf XFD9K3lr+rUTTHNKi2BUl5Waz4/wAWwCmvJk/Y4LgN6ks1RuaETkHFzb/PJITP7UPR afPtrIrPyTIZWSvSMWIm3VAl4vFU7mHK4DF6SeUk= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OadT2yOy62qT; Fri, 12 Feb 2016 14:42:30 -0800 (PST) Received: from [153.66.254.194] (unknown [184.11.141.41]) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 4C2108EE08E; Fri, 12 Feb 2016 14:42:30 -0800 (PST) Message-ID: <1455316946.2396.65.camel@HansenPartnership.com> Subject: aicasm: fix kbuild for separated build directories From: James Bottomley To: linux-scsi Cc: Michal Marek Date: Fri, 12 Feb 2016 14:42:26 -0800 X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I've recently been experimenting with building in emulated architecture containers which allow me to build natively on my laptop a kernel for any architecture which qemu will emulate. To do this, I've been building into build/$(uname -m) and this caused the aicasm stuff to fail to build (using CONFIG_AIC7XXX_BUILD_FIRMWARE=y). I think this patch corrects the problem, but I'm not hugely familiar with the kbuild infrastructure so I cc'd an expert for a second opinion. James --- -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile index 741d818..c21c922 100644 --- a/drivers/scsi/aic7xxx/Makefile +++ b/drivers/scsi/aic7xxx/Makefile @@ -5,7 +5,7 @@ # # Let kbuild descend into aicasm when cleaning -subdir- += aicasm +subdir- += aicasm/ obj-$(CONFIG_SCSI_AIC7XXX) += aic7xxx.o obj-$(CONFIG_SCSI_AIC79XX) += aic79xx.o @@ -55,9 +55,9 @@ aicasm-7xxx-opts-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) := \ ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y) $(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 \ - $(src)/aic7xxx.seq + $(srctree)/$(src)/aic7xxx.seq $(aic7xxx-gen-y): $(obj)/aic7xxx_seq.h else @@ -72,14 +72,14 @@ aicasm-79xx-opts-$(CONFIG_AIC79XX_REG_PRETTY_PRINT) := \ ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y) $(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm - $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h \ - $(aicasm-79xx-opts-y) -o $(obj)/aic79xx_seq.h \ - $(src)/aic79xx.seq + $(obj)/aicasm/aicasm -I$(srctree)/$(src) -r $(obj)/aic79xx_reg.h \ + $(aicasm-79xx-opts-y) -o $@ \ + $(srctree)/$(src)/aic79xx.seq $(aic79xx-gen-y): $(obj)/aic79xx_seq.h else $(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped endif -$(obj)/aicasm/aicasm: $(src)/aicasm/*.[chyl] - $(MAKE) -C $(src)/aicasm +$(obj)/aicasm/aicasm: + $(Q)$(MAKE) $(build)=drivers/scsi/aic7xxx/aicasm all diff --git a/drivers/scsi/aic7xxx/aicasm/Makefile b/drivers/scsi/aic7xxx/aicasm/Makefile index b98c5c1..73559f0 100644 --- a/drivers/scsi/aic7xxx/aicasm/Makefile +++ b/drivers/scsi/aic7xxx/aicasm/Makefile @@ -1,19 +1,22 @@ -PROG= aicasm +PROG= $(obj)/aicasm + +all: $(PROG) .SUFFIXES= .l .y .c .h -CSRCS= aicasm.c aicasm_symbol.c -YSRCS= aicasm_gram.y aicasm_macro_gram.y -LSRCS= aicasm_scan.l aicasm_macro_scan.l +CSRCS= $(srctree)/$(src)/aicasm.c $(srctree)/$(src)/aicasm_symbol.c +YSRCS= $(src)/aicasm_gram.y $(src)/aicasm_macro_gram.y +LSRCS= $(src)/aicasm_scan.l $(src)/aicasm_macro_scan.l -GENHDRS= aicdb.h $(YSRCS:.y=.h) -GENSRCS= $(YSRCS:.y=.c) $(LSRCS:.l=.c) +GENHDRS= $(obj)/aicdb.h $(patsubst $(src)/%.y,$(obj)/%.h,$(YSRCS)) +GENSRCS= $(patsubst $(src)/%.y,$(obj)/%.c,$(YSRCS)) \ + $(patsubst $(src)/%.l,$(obj)/%.c,$(LSRCS)) -SRCS= ${CSRCS} ${GENSRCS} +SRCS= $(CSRCS) $(GENSRCS) LIBS= -ldb clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG) # Override default kernel CFLAGS. This is a userland app. -AICASM_CFLAGS:= -I/usr/include -I. +AICASM_CFLAGS:= -I/usr/include -I. -I$(srctree)/$(src) LEX= flex YACC= bison YFLAGS= -d @@ -32,22 +35,23 @@ YFLAGS+= -t -v LFLAGS= -d endif -$(PROG): ${GENHDRS} $(SRCS) - $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) $(LIBS) +$(PROG): $(GENHDRS) $(SRCS) + echo "SRCS=$(SRCS)" + $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $@ $(LIBS) -aicdb.h: +$(obj)/aicdb.h: @if [ -e "/usr/include/db4/db_185.h" ]; then \ - echo "#include " > aicdb.h; \ + echo "#include " > $(obj)/aicdb.h; \ elif [ -e "/usr/include/db3/db_185.h" ]; then \ - echo "#include " > aicdb.h; \ + echo "#include " > $(obj)/aicdb.h; \ elif [ -e "/usr/include/db2/db_185.h" ]; then \ - echo "#include " > aicdb.h; \ + echo "#include " > $(obj)/aicdb.h; \ elif [ -e "/usr/include/db1/db_185.h" ]; then \ - echo "#include " > aicdb.h; \ + echo "#include " > $(obj)/aicdb.h; \ elif [ -e "/usr/include/db/db_185.h" ]; then \ - echo "#include " > aicdb.h; \ + echo "#include " > $(obj)/aicdb.h; \ elif [ -e "/usr/include/db_185.h" ]; then \ - echo "#include " > aicdb.h; \ + echo "#include " > $(obj)/aicdb.h; \ else \ echo "*** Install db development libraries"; \ fi @@ -58,23 +62,21 @@ clean: # Create a dependency chain in generated files # to avoid concurrent invocations of the single # rule that builds them all. -aicasm_gram.c: aicasm_gram.h -aicasm_gram.c aicasm_gram.h: aicasm_gram.y - $(YACC) $(YFLAGS) -b $(<:.y=) $< - mv $(<:.y=).tab.c $(<:.y=.c) - mv $(<:.y=).tab.h $(<:.y=.h) +$(obj)/aicasm_gram.c $(obj)/aicasm_gram.h: $(src)/aicasm_gram.y + $(YACC) $(YFLAGS) -b $(@:.h=) $< + mv $(@:.h=).tab.c $(@:.h=.c) + mv $(@:.h=).tab.h $(@:.y=.h) # Create a dependency chain in generated files # to avoid concurrent invocations of the single # rule that builds them all. -aicasm_macro_gram.c: aicasm_macro_gram.h -aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y - $(YACC) $(YFLAGS) -b $(<:.y=) -p mm $< - mv $(<:.y=).tab.c $(<:.y=.c) - mv $(<:.y=).tab.h $(<:.y=.h) +$(obj)/aicasm_macro_gram.c $(obj)/aicasm_macro_gram.h: $(src)/aicasm_macro_gram.y + $(YACC) $(YFLAGS) -b $(@:.h=) -p mm $< + mv $(@:.h=).tab.c $(@:.h=.c) + mv $(@:.h=).tab.h $(@:.h=.h) -aicasm_scan.c: aicasm_scan.l +$(obj)/aicasm_scan.c: $(src)/aicasm_scan.l $(LEX) $(LFLAGS) -o$@ $< -aicasm_macro_scan.c: aicasm_macro_scan.l +$(obj)/aicasm_macro_scan.c: $(src)/aicasm_macro_scan.l $(LEX) $(LFLAGS) -Pmm -o$@ $<