Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding compilation arguments to 4000 make files. . .

32 views
Skip to first unread message

Frederick Gotham

unread,
Aug 8, 2019, 10:10:53 AM8/8/19
to

I'm working on a firmware project at the moment, it's running on embedded Linux for a 64-Bit ARM processor (aarch64).

There's the main Makefile, which uses "make -C" to invoke further Makefiles in nested subdirectories. Altogether there's four thousand Makefiles.

I want to able to print out the function call stack, and so I've got code that calls "backtrace" and "backtrace_symbols".

I want to recompile the entire firmware, passing "-funwind-tables" to the compiler, and passing "-rdynamic" to the linker.

If all of my four thousand Makefiles were written properly, all I would have to do is:

export CPPFLAGS=-funwind-tables
export LDEXTRAFLAGS=-rdynamic

Unfortunately, not all four thousand Makefiles are written properly. Some of them have a line like "CPPFLAGS=-Wall", i.e. they use = instead of +=, and so this gets rid of my own special arguments.

I'm thinking maybe I should replace the compiler binary file, and also the linker binary file, with a one-liner script like this:

g++ -funwind-tables -rdynamic $*

Any suggestions on how best to do this?

Ralf Fassel

unread,
Aug 8, 2019, 11:54:21 AM8/8/19
to
* Frederick Gotham <cauldwel...@gmail.com>
| I want to recompile the entire firmware, passing "-funwind-tables" to
| the compiler, and passing "-rdynamic" to the linker.
>
| If all of my four thousand Makefiles were written properly, all I
| would have to do is:
>
| export CPPFLAGS=-funwind-tables
| export LDEXTRAFLAGS=-rdynamic
>
| Unfortunately, not all four thousand Makefiles are written
| properly. Some of them have a line like "CPPFLAGS=-Wall", i.e. they
| use = instead of +=, and so this gets rid of my own special arguments.
>
| I'm thinking maybe I should replace the compiler binary file, and also
| the linker binary file, with a one-liner script like this:
>
| g++ -funwind-tables -rdynamic $*
>
| Any suggestions on how best to do this?

cd /top/of/source/tree
find . -name Makefile | xargs sed -i.bak -e 's/CPPFLAGS *=/CPPFLAGS +=/'

Probably anchor the matches against beginning of line or somesuch.

Untested, of course.

HTH
R'

Szyk Cech

unread,
Aug 8, 2019, 12:35:33 PM8/8/19
to
On 08.08.2019 16:10, Frederick Gotham wrote:
>
> I'm working on a firmware project at the moment, it's running on embedded Linux for a 64-Bit ARM processor (aarch64).
>
> There's the main Makefile, which uses "make -C" to invoke further Makefiles in nested subdirectories. Altogether there's four thousand Makefiles.

If you don't produce one exe from those makefiles then you can make your
life simply and use one CMake file. Then you can use CMakeLists.txt:
[!!! NOT COMPLETE EXAMPLE NOR TESTED !!!]

cmake_minimum_required(VERSION 3.9.0)

project(MyProject)
set(CMAKE_CXX_STANDARD 14)

option(WARNINGS_NOT_ALLOWED "Warnings not allowed when compile." OFF)
option(BUILD_TESTS "Build tests." OFF)

list(APPEND HEADER_SUBDIRS Include Src)
list(APPEND SOURCE_SUBDIRS Src)

# List headers
foreach(DIR IN LISTS HEADER_SUBDIRS)
list(APPEND HEADER_EXPANDED_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.h)
list(APPEND HEADER_EXPANDED_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.hpp)
list(APPEND HEADER_EXPANDED_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.hxx)
list(APPEND HEADER_EXPANDED_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.h++)
endforeach()
file(GLOB_RECURSE HEADER_FILES FOLLOW_SYMLINKS ${HEADER_EXPANDED_DIRS})

# List sources
foreach(DIR IN LISTS SOURCE_SUBDIRS)
list(APPEND SOURCE_EXPANDED_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.c)
list(APPEND SOURCE_EXPANDED_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.cpp)
list(APPEND SOURCE_EXPANDED_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.cxx)
list(APPEND SOURCE_EXPANDED_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.c++)
endforeach()
file(GLOB_RECURSE SOURCE_FILES FOLLOW_SYMLINKS ${SOURCE_EXPANDED_DIRS})

add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES})

# Add include dir
foreach(INCLUDE_DIR IN LISTS INCLUDE_DIRS)
message("INCLUDE_DIR: ${INCLUDE_DIR}")
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIR})
endforeach()

# g++ compiler flags
if (CMAKE_COMPILER_IS_GNUCXX)
if(WARNINGS_NOT_ALLOWED)
message("Warnings not allowed.")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Werror
-Wformat=2
-Wuninitialized -Winit-self -Wswitch-enum -Wundef
-Wpointer-arith -Wdisabled-optimization -Wcast-align
-Wcast-qual)
else()
message("Warnings allowed.")
target_compile_options(${PROJECT_NAME} PRIVATE -Wformat=2 -Wall
-Wuninitialized -Winit-self -Wswitch-enum -Wundef
-Wpointer-arith -Wdisabled-optimization -Wcast-align
-Wcast-qual)
endif()
endif()

Jorgen Grahn

unread,
Aug 8, 2019, 3:02:49 PM8/8/19
to
On Thu, 2019-08-08, Frederick Gotham wrote:
>
> I'm working on a firmware project at the moment, it's running on
> embedded Linux for a 64-Bit ARM processor (aarch64).
>
> There's the main Makefile, which uses "make -C" to invoke further
> Makefiles in nested subdirectories. Altogether there's four thousand
> Makefiles.

Someone somewhere should be fired ...

(I'm assuming you're not just seeing the internals of cmake or a
similar tool auto-generating a gazillion makefiles.)

> I want to able to print out the function call stack, and so I've got
> code that calls "backtrace" and "backtrace_symbols".
>
> I want to recompile the entire firmware, passing "-funwind-tables"
> to the compiler, and passing "-rdynamic" to the linker.
...
> I'm thinking maybe I should replace the compiler binary file, and
> also the linker binary file, with a one-liner script like this:
>
> g++ -funwind-tables -rdynamic $*
>
> Any suggestions on how best to do this?

Am I missing something? Sounds like you have a good solution right
there! Put the script(s) in the $PATH somewhere and you should be
fine.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

Scott Lurndal

unread,
Aug 8, 2019, 3:56:54 PM8/8/19
to
Jorgen Grahn <grahn...@snipabacken.se> writes:
>On Thu, 2019-08-08, Frederick Gotham wrote:
>>
>> I'm working on a firmware project at the moment, it's running on
>> embedded Linux for a 64-Bit ARM processor (aarch64).
>>
>> There's the main Makefile, which uses "make -C" to invoke further
>> Makefiles in nested subdirectories. Altogether there's four thousand
>> Makefiles.
>
>Someone somewhere should be fired ...

Why? Doesn't seem completely out-of-line:

$ find bootloader firmware -name Makefile | wc -l
929

If you're also building linux:
$ find linux -name Makefile | wc -l
2064

>
>(I'm assuming you're not just seeing the internals of cmake or a
>similar tool auto-generating a gazillion makefiles.)
>
>> I want to able to print out the function call stack, and so I've got
>> code that calls "backtrace" and "backtrace_symbols".
>>
>> I want to recompile the entire firmware, passing "-funwind-tables"
>> to the compiler, and passing "-rdynamic" to the linker.
>...
>> I'm thinking maybe I should replace the compiler binary file, and
>> also the linker binary file, with a one-liner script like this:
>>
>> g++ -funwind-tables -rdynamic $*
>>
>> Any suggestions on how best to do this?

I'd look at trying to tell make to use a modified default rule
set, then you can have a rule like:

%.o $(OBJDIR)/%.o: %.c
@$(QUIET) || echo " COMPILE $<"
$(HUSHCOMPILE)$(CC) $(CFLAGS) -funwind-tables -rdynamic -MMD -MP -o $@ -c $<

%.o $(OBJDIR)/%.o: %.cpp
@$(QUIET) || echo " COMPILE $<"
$(HUSHCOMPILE)$(COMPILE.cpp) -funwind-tables -rdynamic -MMD -MP -o $@ $<

I don't see anything in the man page that allows that with gmake, however.

Frederick Gotham

unread,
Aug 9, 2019, 9:46:59 AM8/9/19
to
Here's the *nix bash script I've got for the time being:

#!/bin/bash

EXTRA_COMPILER_FLAGS="-rdynamic -funwind-tables"
EXTRA_LINKER_FLAGS="-funwind-tables"

DIR1="/usr/bin/"
DIR1_FILE1="x86_64-linux-gnu-g++-7"
DIR1_FILE2="x86_64-linux-gnu-gcc-7"
DIR1_FILE3="x86_64-linux-gnu-ld.bfd"

DIR2="./toolchain/arm/bin/"
DIR2_FILE1="aarch64-linux-gnu-g++"
DIR2_FILE2="aarch64-linux-gnu-gcc"
DIR2_FILE3="aarch64-linux-gnu-ld"

if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi

if [ "$1" == "undo" ]; then

echo
echo "Undoing everything. . . "
echo

if [ -f "${DIR1}REAL_${DIR1_FILE1}" ]; then
rm -f "${DIR1}${DIR1_FILE1}"
mv "${DIR1}REAL_${DIR1_FILE1}" "${DIR1}${DIR1_FILE1}"
fi

if [ -f "${DIR1}REAL_${DIR1_FILE2}" ]; then
rm -f "${DIR1}${DIR1_FILE2}"
mv "${DIR1}REAL_${DIR1_FILE2}" "${DIR1}${DIR1_FILE2}"
fi

if [ -f "${DIR1}REAL_${DIR1_FILE3}" ]; then
rm -f "${DIR1}${DIR1_FILE3}"
mv "${DIR1}REAL_${DIR1_FILE3}" "${DIR1}${DIR1_FILE3}"
fi

if [ -f "${DIR2}REAL_${DIR2_FILE1}" ]; then
rm -f "${DIR2}${DIR2_FILE1}"
mv "${DIR2}REAL_${DIR2_FILE1}" "${DIR2}${DIR2_FILE1}"
fi

if [ -f "${DIR2}REAL_${DIR2_FILE2}" ]; then
rm -f "${DIR2}${DIR2_FILE2}"
mv "${DIR2}REAL_${DIR2_FILE2}" "${DIR2}${DIR2_FILE2}"
fi

if [ -f "${DIR2}REAL_${DIR2_FILE3}" ]; then
rm -f "${DIR2}${DIR2_FILE3}"
mv "${DIR2}REAL_${DIR2_FILE3}" "${DIR2}${DIR2_FILE3}"
fi

exit 0
fi

if [ -f "${DIR1}REAL_${DIR1_FILE1}" ]; then
echo "This script has already been run. It cannot be run a second time. You must do \"./replacer_script.sh undo\" first."
exit 1
fi

if [ ! -d "./toolchain" ]; then
echo "This script must be run from within the firmware directory, e.g. ~/svndir/illustra_amb_02_00, or ~/svndir/i825md_AMBARELLA"
exit 1
fi

FIRMWARE_DIR=`pwd`

echo "------------------------------------------------------------"
echo "FIRST TO REPLACE: x86_64 compilers in the directory /usr/bin"
echo "------------------------------------------------------------"
echo

echo "1: Navigating into directory: ${DIR1}"
echo
echo " $ cd ${DIR1}"
echo
cd ${DIR1}

echo "2: Renaming '${DIR1_FILE1}' to 'REAL_${DIR1_FILE1}'"
echo
echo " $ mv ${DIR1_FILE1} REAL_${DIR1_FILE1}"
echo
mv ${DIR1_FILE1} REAL_${DIR1_FILE1}

echo " Renaming '${DIR1_FILE2}' to 'REAL_${DIR1_FILE2}'"
echo
echo " $ mv ${DIR1_FILE2} REAL_${DIR1_FILE2}"
echo
mv ${DIR1_FILE2} REAL_${DIR1_FILE2}

echo " Renaming '${DIR1_FILE3}' to 'REAL_${DIR1_FILE3}'"
echo
echo " $ mv ${DIR1_FILE3} REAL_${DIR1_FILE3}"
echo
mv ${DIR1_FILE3} REAL_${DIR1_FILE3}

echo "3: Creating empty script '${DIR1_FILE1}' and enabling the execution flag"
echo
echo " $ touch ${DIR1_FILE1}"
echo " $ chmod +x ${DIR1_FILE1}"
echo
touch ${DIR1_FILE1}
chmod +x ${DIR1_FILE1}

echo " Creating empty script '${DIR1_FILE2}' and enabling the execution flag"
echo
echo " $ touch ${DIR1_FILE2}"
echo " $ chmod +x ${DIR1_FILE2}"
echo
touch ${DIR1_FILE2}
chmod +x ${DIR1_FILE2}

echo " Creating empty script '${DIR1_FILE3}' and enabling the execution flag"
echo
echo " $ touch ${DIR1_FILE3}"
echo " $ chmod +x ${DIR1_FILE3}"
echo
touch ${DIR1_FILE3}
chmod +x ${DIR1_FILE3}

echo "4: Adding two lines to each script"
echo
echo " $ echo \"echo \\\"REAL_${DIR1_FILE1} ${EXTRA_COMPILER_FLAGS} \\\$*\\\"\" > ${DIR1_FILE1}"
echo " $ echo \"REAL_${DIR1_FILE1} ${EXTRA_COMPILER_FLAGS} \\\$*\" >> ${DIR1_FILE1}"
echo "echo \"REAL_${DIR1_FILE1} ${EXTRA_COMPILER_FLAGS} \$*\"" > ${DIR1_FILE1}
echo "REAL_${DIR1_FILE1} ${EXTRA_COMPILER_FLAGS} \$*" >> ${DIR1_FILE1}
echo
echo " $ echo \"echo \\\"REAL_${DIR1_FILE2} ${EXTRA_COMPILER_FLAGS} \\\$*\\\"\" > ${DIR1_FILE2}"
echo " $ echo \"REAL_${DIR1_FILE2} ${EXTRA_COMPILER_FLAGS} \\\$*\" >> ${DIR1_FILE2}"
echo "echo \"REAL_${DIR1_FILE2} ${EXTRA_COMPILER_FLAGS} \$*\"" > ${DIR1_FILE2}
echo "REAL_${DIR1_FILE2} ${EXTRA_COMPILER_FLAGS} \$*" >> ${DIR1_FILE2}
echo
echo " $ echo \"if [[ \$* == *\"-shared\"* ]]; then\" > ${DIR1_FILE3}"
echo " $ echo \"echo \\\"REAL_${DIR1_FILE3} ${EXTRA_LINKER_FLAGS} \\\$*\\\"\" > ${DIR1_FILE3}"
echo " $ echo \"REAL_${DIR1_FILE3} ${EXTRA_LINKER_FLAGS} \\\$*\" >> ${DIR1_FILE3}"
echo " $ echo \"else\" >> ${DIR1_FILE3}"
echo " $ echo \"echo \\\"REAL_${DIR1_FILE3} \\\$*\\\"\" > ${DIR1_FILE3}"
echo " $ echo \"REAL_${DIR1_FILE3} \\\$*\" >> ${DIR1_FILE3}"
echo " $ echo \"fi\" >> ${DIR1_FILE3}"
echo "if [[ \$* == *\"-shared\"* ]]; then" > ${DIR1_FILE3}
echo "echo \"REAL_${DIR1_FILE3} ${EXTRA_LINKER_FLAGS} \$*\"" >> ${DIR1_FILE3}
echo "REAL_${DIR1_FILE3} ${EXTRA_LINKER_FLAGS} \$*" >> ${DIR1_FILE3}
echo "else" >> ${DIR1_FILE3}
echo "echo \"REAL_${DIR1_FILE3} \$*\"" >> ${DIR1_FILE3}
echo "REAL_${DIR1_FILE3} \$*" >> ${DIR1_FILE3}
echo "fi" >> ${DIR1_FILE3}

cd $FIRMWARE_DIR

echo "---------------------------------------------------------------"
echo "SECOND TO REPLACE: aarch64 compilers in the toolchain directory"
echo "---------------------------------------------------------------"
echo
echo "1: Navigating into directory: ${DIR2}"
echo
echo " $ cd ${DIR2}"
echo
cd ${DIR2}

echo "2: Renaming '${DIR2_FILE1}' to 'REAL_${DIR2_FILE1}'"
echo
echo " $ mv ${DIR2_FILE1} REAL_${DIR2_FILE1}"
echo
mv ${DIR2_FILE1} REAL_${DIR2_FILE1}

echo " Renaming '${DIR2_FILE2}' to 'REAL_${DIR2_FILE2}'"
echo
echo " $ mv ${DIR2_FILE2} REAL_${DIR2_FILE2}"
echo
mv ${DIR2_FILE2} REAL_${DIR2_FILE2}

echo " Renaming '${DIR2_FILE3}' to 'REAL_${DIR2_FILE3}'"
echo
echo " $ mv ${DIR2_FILE3} REAL_${DIR2_FILE3}"
echo
mv ${DIR2_FILE3} REAL_${DIR2_FILE3}

echo "3: Creating empty script '${DIR2_FILE1}' and enabling the execution flag"
echo
echo " $ touch ${DIR2_FILE1}"
echo " $ chmod +x ${DIR2_FILE1}"
echo
touch ${DIR2_FILE1}
chmod +x ${DIR2_FILE1}

echo " Creating empty script '${DIR2_FILE2}' and enabling the execution flag"
echo
echo " $ touch ${DIR2_FILE2}"
echo " $ chmod +x ${DIR2_FILE2}"
echo
touch ${DIR2_FILE2}
chmod +x ${DIR2_FILE2}

echo " Creating empty script '${DIR2_FILE3}' and enabling the execution flag"
echo
echo " $ touch ${DIR2_FILE3}"
echo " $ chmod +x ${DIR2_FILE3}"
echo
touch ${DIR2_FILE3}
chmod +x ${DIR2_FILE3}

echo "4: Adding two lines to each script"
echo
echo " $ echo \"echo \\\"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE1} ${EXTRA_COMPILER_FLAGS} \\\$*\\\"\" > ${DIR2_FILE1}"
echo " $ echo \"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE1} ${EXTRA_COMPILER_FLAGS} \\\$*\" >> ${DIR2_FILE1}"
echo "echo \"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE1} ${EXTRA_COMPILER_FLAGS} \$*\"" > ${DIR2_FILE1}
echo "${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE1} ${EXTRA_COMPILER_FLAGS} \$*" >> ${DIR2_FILE1}
echo
echo " $ echo \"echo \\\"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE2} ${EXTRA_COMPILER_FLAGS} \\\$*\\\"\" > ${DIR2_FILE2}"
echo " $ echo \"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE2} ${EXTRA_COMPILER_FLAGS} \\\$*\" >> ${DIR2_FILE2}"
echo "echo \"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE2} ${EXTRA_COMPILER_FLAGS} \$*\"" > ${DIR2_FILE2}
echo "${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE2} ${EXTRA_COMPILER_FLAGS} \$*" >> ${DIR2_FILE2}
echo
echo " $ echo \"if [[ \$* == *\"-shared\"* ]]; then\" > ${DIR2_FILE3}"
echo " $ echo \"echo \\\"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE3} ${EXTRA_LINKER_FLAGS} \\\$*\\\"\" > ${DIR2_FILE3}"
echo " $ echo \"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE3} ${EXTRA_LINKER_FLAGS} \\\$*\" >> ${DIR2_FILE3}"
echo " $ echo \"else\" >> ${DIR2_FILE3}"
echo " $ echo \"echo \\\"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE3} \\\$*\\\"\" > ${DIR2_FILE3}"
echo " $ echo \"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE3} \\\$*\" >> ${DIR2_FILE3}"
echo " $ echo \"fi\" >> ${DIR2_FILE3}"
echo "if [[ \$* == *\"-shared\"* ]]; then" > ${DIR2_FILE3}
echo "echo \"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE3} ${EXTRA_LINKER_FLAGS} \$*\"" >> ${DIR2_FILE3}
echo "${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE3} ${EXTRA_LINKER_FLAGS} \$*" >> ${DIR2_FILE3}
echo "else" >> ${DIR2_FILE3}
echo "echo \"${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE3} \$*\"" >> ${DIR2_FILE3}
echo "${FIRMWARE_DIR}/${DIR2}/REAL_${DIR2_FILE3} \$*" >> ${DIR2_FILE3}
echo "fi" >> ${DIR2_FILE3}
echo

cd $FIRMWARE_DIR

Jorgen Grahn

unread,
Aug 9, 2019, 10:02:10 AM8/9/19
to
On Thu, 2019-08-08, Scott Lurndal wrote:
> Jorgen Grahn <grahn...@snipabacken.se> writes:
>>On Thu, 2019-08-08, Frederick Gotham wrote:
>>>
>>> I'm working on a firmware project at the moment, it's running on
>>> embedded Linux for a 64-Bit ARM processor (aarch64).
>>>
>>> There's the main Makefile, which uses "make -C" to invoke further
>>> Makefiles in nested subdirectories. Altogether there's four thousand
>>> Makefiles.
>>
>>Someone somewhere should be fired ...
>
> Why? Doesn't seem completely out-of-line:
>
> $ find bootloader firmware -name Makefile | wc -l
> 929

Because I believe in the Recursive Make Considered Harmful paper:
http://aegis.sourceforge.net/auug97.pdf

> If you're also building linux:
> $ find linux -name Makefile | wc -l
> 2064

IIRC, Linux falls into the next category:

>>(I'm assuming you're not just seeing the internals of cmake or a
>>similar tool auto-generating a gazillion makefiles.)

Scott Lurndal

unread,
Aug 9, 2019, 10:37:03 AM8/9/19
to
Jorgen Grahn <grahn...@snipabacken.se> writes:
>On Thu, 2019-08-08, Scott Lurndal wrote:
>> Jorgen Grahn <grahn...@snipabacken.se> writes:
>>>On Thu, 2019-08-08, Frederick Gotham wrote:
>>>>
>>>> I'm working on a firmware project at the moment, it's running on
>>>> embedded Linux for a 64-Bit ARM processor (aarch64).
>>>>
>>>> There's the main Makefile, which uses "make -C" to invoke further
>>>> Makefiles in nested subdirectories. Altogether there's four thousand
>>>> Makefiles.
>>>
>>>Someone somewhere should be fired ...
>>
>> Why? Doesn't seem completely out-of-line:
>>
>> $ find bootloader firmware -name Makefile | wc -l
>> 929
>
>Because I believe in the Recursive Make Considered Harmful paper:
>http://aegis.sourceforge.net/auug97.pdf

That paper has never been convincing to me, nor anyone that I've
ever worked with, nor any unix or linux os or other large sourcebase
that I've worked on professionally.

>
>> If you're also building linux:
>> $ find linux -name Makefile | wc -l
>> 2064
>
>IIRC, Linux falls into the next category:
>
>>>(I'm assuming you're not just seeing the internals of cmake or a
>>>similar tool auto-generating a gazillion makefiles.)

You do not recall correctly. kernel makefiles are not generated.

scott

Ian Collins

unread,
Aug 9, 2019, 5:43:29 PM8/9/19
to
On 10/08/2019 02:36, Scott Lurndal wrote:
> Jorgen Grahn <grahn...@snipabacken.se> writes:
>> On Thu, 2019-08-08, Scott Lurndal wrote:
>>> Jorgen Grahn <grahn...@snipabacken.se> writes:
>>>> On Thu, 2019-08-08, Frederick Gotham wrote:
>>>>>
>>>>> I'm working on a firmware project at the moment, it's running on
>>>>> embedded Linux for a 64-Bit ARM processor (aarch64).
>>>>>
>>>>> There's the main Makefile, which uses "make -C" to invoke further
>>>>> Makefiles in nested subdirectories. Altogether there's four thousand
>>>>> Makefiles.
>>>>
>>>> Someone somewhere should be fired ...
>>>
>>> Why? Doesn't seem completely out-of-line:
>>>
>>> $ find bootloader firmware -name Makefile | wc -l
>>> 929
>>
>> Because I believe in the Recursive Make Considered Harmful paper:
>> http://aegis.sourceforge.net/auug97.pdf
>
> That paper has never been convincing to me, nor anyone that I've
> ever worked with, nor any unix or linux os or other large sourcebase
> that I've worked on professionally.

It convinced me long ago... Recursive Make makes distributed building
much harder. My current project code base is modest (about 3,000 source
files in multiple libraries) but we only have one "makefile". It isn't
actually a makefile, we use premake to to generate a ninja build file.

--
Ian.

David Brown

unread,
Aug 10, 2019, 11:07:05 AM8/10/19
to
On 09/08/2019 16:36, Scott Lurndal wrote:
> Jorgen Grahn <grahn...@snipabacken.se> writes:
>> On Thu, 2019-08-08, Scott Lurndal wrote:
>>> Jorgen Grahn <grahn...@snipabacken.se> writes:
>>>> On Thu, 2019-08-08, Frederick Gotham wrote:
>>>>>
>>>>> I'm working on a firmware project at the moment, it's running on
>>>>> embedded Linux for a 64-Bit ARM processor (aarch64).
>>>>>
>>>>> There's the main Makefile, which uses "make -C" to invoke further
>>>>> Makefiles in nested subdirectories. Altogether there's four thousand
>>>>> Makefiles.
>>>>
>>>> Someone somewhere should be fired ...
>>>
>>> Why? Doesn't seem completely out-of-line:
>>>
>>> $ find bootloader firmware -name Makefile | wc -l
>>> 929
>>
>> Because I believe in the Recursive Make Considered Harmful paper:
>> http://aegis.sourceforge.net/auug97.pdf
>
> That paper has never been convincing to me, nor anyone that I've
> ever worked with, nor any unix or linux os or other large sourcebase
> that I've worked on professionally.
>

I have had enough trouble dealing with projects that contain separate
Makefiles for different parts, yet depend on odd ways across parts, to
be convinced by the paper. Far too often I've to do "make clean" before
a "make" because of badly coordinated sub-makes.

I am sure it is /possible/ to have large systems with recursive makes
that work well. Equally, I am sure that often such systems are not done
well.
0 new messages