Page 1 of 1

To make or not to make?

Posted: Sat Aug 06, 2011 10:48 am
by Creature
As a private (mostly auto-didactic) project, I'm writing a simple IDE (in the hope that someday, I'll be able to use it myself). I've completed most of the basic editing features and already designed the project system. Soon I will have to be dealing with building. I'm not sure as of what choice to make at this point, so I was hoping you could help shed some light as to the (dis)advantages of either choice: I have to choose whether or not to use a make-based build system (thus, using makefiles).

If I use makefiles, this is basically what the IDE is going to be doing:
  • Project is created, basic makefile is automatically generated (unless the user chooses to use a custom makefile).
  • If needed, the makefile is updated when needed (e.g. new files are added to the project).
  • A user specifies a valid make executable which will be called on the makefile in question.
  • Any messages output by make (and tools such as GCC), such as error messages and warnings, will be placed in a convenient widget.
If I don't choose makefiles, I will have to write my own build system, which is more like this:
  • The user defines what tools are used for what file extensions. All the project's files (unless excluded from build), are fed into the build system. It will determine which tool to call for what file and make sure all the processor cores are properly utilized.
  • Messages output by any of the tools (such as GCC) will be placed in a widget, just like with make.
So far, so good. Both options are very doable and look promising. I also already have some pros and cons figured out on either side:

Makefile-based:
  • Make and makefiles are well-known, mature and most programmers know about them.
  • No need to write a custom build system, make will handle calling the appropriate file on the appropriate moment.
  • Dependencies will be handled for you.
  • Make's behaviour can be altered through command line switches. Running multiple jobs simultaneously is supported out-of-the-box.
  • Most UNIX or Linux-based systems come with make shipped.
Custom build-system:
  • Very newbie-friendly: they might either not know what make is, not be able to find a precompiled binary, or build it from source (this especially applies on Windows).
  • No need for third-party software to be used (building is supported out-of-the-box).
  • Less setup required to get building properly working.
  • An internal build system is more tightly integrated with the IDE, allowing for it to be optimized and designed specifically for use with that software product.
I used the first point because I noticed that a lot of newcomers to C/C++ tend to use (or be recommended) to use Visual C++ (which also has a non-make buildsystem if nmake isn't used). Then again, Dev-C++ used to be a very popular Windows IDE as well, and IIRC it also used makefiles. So point 1 on the list may also apply to make, if the IDE were to be made newb-friendly enough (and most of the make stuff is abstracted from the newbies).

So both solutions have their upsides. I'm really not sure with which one to go, which is why I'd like to hear some opinions on the subject, see what other people think about this.

Re: To make or not to make?

Posted: Sat Aug 06, 2011 11:39 am
by Solar
Let me tell you a little story.

A Java project I had to handle at the office just recently was set up by some Eclipse geek. He showed the way to build it to me: "It's all very simple, you just click on 'export runnable JAR', check this and that option, and you're done." Shaking my head a bit because I have different ideas of "simple", I returned to my desk. Erm... uhm... how do I open this thing in Eclipse? Return to the coworker: "Oh, sure, you first have to check out the project in Eclipse." Sorry? I already have the project checked-out, here on my hard drive? "No, you have to check it out inside the IDE." Ah. Well... how do I do that? I don't seem to have the same popup-menu options as he does. "Oh, you don't have the Subversion plug-in installed." So I did that. Compiled the JAR file... didn't work. "Oh, you have to set your Eclipse to use Java 1.4, the servers don't support the later versions." Etc. etc... that was a couple of days ago. Today, the project contains - at top level - both a build.xml (for "ant") and a Makefile (for "make", which in turn runs "ant") written by me, and if you don't have a Java SDK of the proper version installed, the build.xml will tell you that you need version 1.4 because the servers don't support the later versions. In plain language.

Let me tell you another little story.

One of our software packages requires the Boost library. Not the binary one distributed by boost.org, but one that was compiled with ICU support (which boost.org does not provide). Boost is built using BJAM, the build system made-by-Boost. And every other release of Boost, something in the build system is changed, so we have to adjust the compile options used, but BJAM isn't really forthcoming with what exactly the reason for failure was, and no-one at our office really understands the BJAM system anyway (or has the time and motivation to learn it), and it has cost us dozens of man-days already, all told. (On the upside, we've been able to submit two patches to Boost.org and found one bug in the IBM debugger for AIX in the process, but that's not exactly what our budget is for, if you get my drift.)

Bottom line, please don't invent another custom build system. Make your IDE play nice with Makefiles, or Ant, or Maven2 or whatever, like automatically generating their respective configuration files and doing nifty highlighting of the error messages or somesuch, and bundle the appropriate executables with your IDE so people don't have to install make / ant / maven / ... seperately, but don't try to reinvent the wheel on the build system front.

If everything fails, I want to be able to build a project without having your specific IDE available. Having the freedom to not use your product is a "pro" for software that has fallen into obscurity, but those who ever were in that particular situation will thank and praise you for it.

Re: To make or not to make?

Posted: Sat Aug 06, 2011 12:10 pm
by Creature
Your arguments are indeed very convincing. I'm developing this IDE for myself because I was never happy with the other IDE's out there (they all seem to have a major flaw for me that I'd rather not see). Sticking to a simple text editor and running tools such as GDB from the command line I find to be a pain in the butt mostly (especially if I know it can be eased a lot by simply making your IDE properly support it). It would be stupid of me to make people have a hard time converting their projects to or from my IDE, since that was one of the major annoyances with switching between IDE's for myself.

Perhaps I should also provide the users with a link or a location where they can acquire make (e.g. from MSYS for Windows users).

Thank you very much for your input, it was what I needed to make a decision. Of course if someone else wishes to add something, feel free.