View Single Post
  #7   (View Single Post)  
Old 5th July 2017
Funkygoby Funkygoby is offline
Fdisk Soldier
 
Join Date: Aug 2015
Posts: 57
Default

Hello,
After improving, almost finalizing my build system, I hit a brick wall and gave up makefiles. I now use a Python script.

Here is my story:

1. The build system (take 1)
When I started working again on my makefiles (see the old version above), it was to add the capability to have a centralized include folder (for code shared between a lot of sources files: layout description) and output folder (where the compiled pdfs and midi would go).
As mentionned previously, I wanted to avoid copy/pasting the makefiles everywhere and decided to use symlinks instead that would need to be created automatically for convenience. Speaking of automation, that would be the time for cleaning the mess in the source tree.

2. Cleaning
Since Shell script are still alien to me after all those years, I went with Python and managed to craft a script that spotted and removed 7 years of pdfs, midi, ps, hidden vim files, ... accumulated everywhere. It also reorganized the tree, created all the symlinks in the right places and edited the sources files (I know I shouldn't do that) to adapt the include to the new system.
The cleanning process and build tests worked fine on my test tree. Time to try this on the real thing

3. Sadness
The cleaning script worked fine with only minor manual intervention for corner cases but trying to build the whole tree crashed as soon as it tried to build a source file with spaces in name.
Obviously since make(1) uses spaces to separate between target, he will see esa mujer.ly as two different targets esa and mujer.ly. There are workaround but that won't work with wildcard and since I used that a lot (my tree is very dynamic, shape-shifting), I was screwed.

4. Reinvent the wheel
Every steps of the goal I was trying to achieve with make(1) were painful and everything that make makefiles great were useless to me. Wrong tool for the job.
I took a quick look to other build automation systems and finally decided to keep going with scripts and python but to craft everything myself instead.
Two evenings later, I had a working build.py sitting in ~/bin. It can be called from everywhere in the tree, can take several arguments if several file/folder need to be built, it doesn't require to put symlinks everywhere and I understand every line of it. It needs improvements and cleaner comments before sharing it. Anyone interested?

In the end, the problem I was trying to solve seems to be niche enough to require a custom made solution.

Thanks everyone.
Reply With Quote