Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #30957

Re: Makefile or IDE?

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.arch.embedded
Subject Re: Makefile or IDE?
Date 2021-12-10 19:44 +0100
Organization A noiseless patient Spider
Message-ID <sp077b$v6c$1@dont-email.me> (permalink)
References (2 earlier) <sofg1s.13g.1@stefan.msgid.phost.de> <sog15s$uj0$1@dont-email.me> <sog5o6$k3j$1@dont-email.me> <sosn9a$rsq$1@dont-email.me> <j1hhfuF9u0iU1@mid.dfncis.de>

Show all headers | View raw


On 10/12/2021 18:35, Hans-Bernhard Bröker wrote:
> Am 09.12.2021 um 11:54 schrieb pozz:
> 
>> I'd prefer to have the same tree in source and build dirs:
> 
> What on earth for?
> 
> Subdirectories for sources are necessary to organize our work, because
> humans can't deal too well with folders filled with hundreds of files,
> and because we fare better with the project's top-down structure
> tangibly represented as a tree of subfolders.
> 
> But let's face it: we very rarely even look at object files, much less
> work on them in any meaningful fashion.  They just have to be somewhere,
> but it's no particular burden at all if they're all in a single folder,
> per primary build target.  They're for the compiler and make alone to
> work on, not for humans.  So they don't have to be organized for human
> consumption.
> 
> That's why virtually all hand-written Makefiles I've ever seen, and a
> large portion of the auto-generated ones, too, keep all of a target's
> object, list and dependency files in a single folder.  Mechanisms like
> VPATH exist for the express purpose of easing this approach, and the
> built-in rules and macros also largely rely on it.
> 
> The major exception in this regard is CMake, which does indeed mirror
> the source tree layout --- but that's manageable for them only because
> their Makefiles, being fully machine-generated, can become almost
> arbitrarily complex, for no extra cost.  Nobody in full possession of
> their mental capabilities would ever write Makefiles the way CMake does
> it, by hand.

There are other automatic systems that mirror the structure of the
source tree for object files, dependency files and list files (yes, some
people still like these).  Eclipse does it, for example, and therefore
the majority of vendor-supplied toolkits since most are Eclipse based.
(I don't know if NetBeans and Visual Studio / Visual Studio Code do so -
these are the other two IDE's commonly used by manufacturer tools).

The big advantage of having object directories that copy source
directories is that it all works even if you have more than one file
with the same name.  Usually, of course, you want to avoid name
conflicts - there are risks of other issues or complications such as
header guard symbols that are not unique (they /can/ include directory
information and not just the filename, but they don't always do so) and
you have to be careful that you #include the files you meant.  But with
big projects containing SDK files, third-party libraries, RTOS's,
network stacks, and perhaps files written by many people working
directly on the project, conflicts happen.  "timers.c" and "utils.c"
sound great to start with, but there is a real possibility of more than
one turning up in a project.

It is not at all hard to make object files mirror the source tree, and
it adds nothing to the build time.  For large projects, it is clearly
worth the effort.  (For small projects, it is probably not necessary.)

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-02 12:46 +0100
  Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-02 15:22 +0000
    Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-02 17:34 +0100
      Re: Makefile or IDE? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-12-03 13:15 +0200
  Re: Makefile or IDE? Don Y <blockedofcourse@foo.invalid> - 2021-12-02 09:48 -0700
  Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-02 17:34 +0100
    Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-03 11:49 +0100
      Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-03 18:27 +0100
    Re: Makefile or IDE? George Neuner <gneuner2@comcast.net> - 2021-12-04 14:37 -0500
  Re: Makefile or IDE? Theo <theom+news@chiark.greenend.org.uk> - 2021-12-03 20:51 +0000
    Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-03 21:28 +0000
      Re: Makefile or IDE? George Neuner <gneuner2@comcast.net> - 2021-12-04 14:53 -0500
        Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-04 22:17 +0100
          Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-05 11:02 +0100
            Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-05 13:16 +0100
        Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-06 13:52 +0000
          Re: Makefile or IDE? chris <chris-nospam@tridac.net> - 2021-12-17 17:19 +0000
  Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-03 23:48 +0100
    Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-04 10:31 +0100
      Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-04 16:23 +0100
        Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-04 17:41 +0100
          Re: Makefile or IDE? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-12-04 18:49 +0200
            Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-04 18:23 +0100
              Re: Makefile or IDE? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-12-04 21:25 +0200
                Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-04 22:20 +0100
                Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-06 13:51 +0000
                Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-06 16:33 +0100
                Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-06 16:02 +0000
          Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-09 11:54 +0100
            Re: Makefile or IDE? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2021-12-10 18:35 +0100
              Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-10 19:44 +0100
                Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-11 16:18 +0100
                Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-11 17:06 +0100
                Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-11 16:57 +0000
                Re: Makefile or IDE? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2021-12-11 18:53 +0100
                Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-12 14:15 +0100
              Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-11 10:01 +0100
                Re: Makefile or IDE? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2021-12-11 18:47 +0100
                Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-12 11:27 +0100
        Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-05 11:11 +0100
          Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-05 13:21 +0100
  Re: Makefile or IDE? Dave Nadler <drn@nadler.com> - 2021-12-06 15:45 -0500
  Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-09 10:43 +0100
  Re: Makefile or IDE? Johann Klammer <klammerj@NOSPAM.a1.net> - 2021-12-10 09:30 +0100
  Re: Makefile or IDE? chris <chris-nospam@tridac.net> - 2021-12-17 17:27 +0000
    Re: Makefile or IDE? StateMachineCOM <statemachineguru@gmail.com> - 2021-12-20 17:18 -0800
      Re: Makefile or IDE? chris <chris-nospam@tridac.net> - 2021-12-21 16:45 +0000
      Re: Makefile or IDE? Jim Jackson <jj@franjam.org.uk> - 2021-12-21 17:40 +0000
        Re: Makefile or IDE? StateMachineCOM <statemachineguru@gmail.com> - 2021-12-21 10:55 -0800

csiph-web