From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757016AbcAYLdh (ORCPT ); Mon, 25 Jan 2016 06:33:37 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:37629 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756966AbcAYLde (ORCPT ); Mon, 25 Jan 2016 06:33:34 -0500 To: linux-kbuild@vger.kernel.org, mmarek@suse.com From: Kieran Bingham Subject: Dependency issue through subdir's X-Enigmail-Draft-Status: N1110 Cc: Jan Kiszka , Lee Jones , Peter Griffin , Linux Kernel Message-ID: <56A6080C.2070006@kbingham.co.uk> Date: Mon, 25 Jan 2016 11:33:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I am having difficulty with dependencies while trying to create an automatically generated file in linux/scripts/gdb/ This autogenerated file, includes the kernel headers, so that we can access kernel constants from GDB. As such, I need to parse C-headers into a python-compatible file. The commit-diff at : https://git.linaro.org/people/kieran.bingham/linux.git/commitdiff/26194ca0579ec94b3630f1aac0e985242831aa1c shows the current implementation. This is functional on a make -j1 build, however at -j2 and above (from a clean build), kbuild attempts to generate my file before include/generated/timeconst.h resulting in the following error: --- 8< --- GEN scripts/gdb/linux/constants.py In file included from sources/linux/include/linux/ktime.h:25:0, from /linux/include/linux/rcupdate.h:47, from /linux/include/linux/rbtree.h:34, from /linux/include/linux/mm_types.h:9, from /linux/arch/x86/include/asm/pgtable.h:448, from /linux/scripts/gdb/linux/constants.py.in:16: sources/linux/include/linux/jiffies.h:10:33: fatal error: generated/timeconst.h: No such file or directory --- >8 --- I have tried to provide a dependency on include/generated/timeconst.h, however, because scripts/gdb/ is a subdir-y target, it is run through a submake, and the parent directory targets are not available. I have also tried to look at how to delay the execution of the scripts/gdb subdir - but subdir-ym is simply a sorted list, (and using subdir-m += scripts/gdb didn't help) I feel like I have the following possible approaches to solving this: 1) Create a 'subdir-late-' target group which builds specifically as late in the build process as possible 2) Move the code that generates this file to /Kbuild. However I don't like the idea of putting non-essential generator at the top level build 3) Add #ifndef __GENERATE_CONSTANTS_PY__ across any reference to generated header files, such as in ktime.h, and define that with my Preprocessor statement. Are there any other solutions? I dislike all 3 of the options above ... I'd appreciate any thoughts here. -- Regards Kieran Bingham