Reputation: 95951
A makefile is typically used for source compilation; however, as a dependency mechanism, make
can have many more uses.
For a minor example, I have a script that runs daily, and it might update or create some '*.csv.gz' files in a directory based on some web-scraping; all the gzipped files need to be consolidated into one file, and if there are new files, obviously the consolidation process needs to be run.
In my case, the following makefile does the job:
consolidation: datasummary.pcl
datasummary.pcl: *.csv.gz
consolidate.py
The cron job runs the update process, and then make consolidation
; if the datasummary.pcl
file is older than any *.csv.gz
file, consolidate.py
runs.
I'm very interested in ideas about unusual (i.e. not about source compiling) uses of a makefile. What other interesting examples of makefile usage can you give?
Let's assume we talk about GNU make; if otherwise, please specify version.
Upvotes: 3
Views: 880
Reputation: 293
On a system I administer at work we use a makefile and some scripts to generate config files for named, dhcpd and pxe booting. The input file is along the lines of:
ipaddr name alias1 alias2 # model os printer
for example:
192.168.0.1 battledown nfs dns ldap # x3550 RHEL5u4 brother-color
We then have a makefile which runs that input file though various scripts to generate the appropriate configurations. It will then restart any daemons whose configs have changed.
Upvotes: 1
Reputation: 50951
I remember seeing something several years ago about booting Linux systems using Makefiles. Individual system components were set as targets and make would load up the dependencies first, like make does. I believe they got impressive boot speeds out of it. That's what led to the dependency-based boot in Debian/Ubuntu.
Upvotes: 1