Gmake and System Administration

When administering Linux, sometimes it necessary to build new software. Over the years, it is easy to see that the process of building software using compilers and make files can easily and appropriately applied to administrative processes. Why create a script with an arbitrary name when you can put a Makefile in a current working directory that adheres to a “help” target? No matter where you go, if you see a Makefile in your CWD, you should be able to type gmake help and see reasoning behind what is there.

Sometimes, to do this, you need wildcard targets. This is a very handy voodoo:

help:
       @echo Usage: gmake argument

%::
        @echo $@

With this Makefile, if I:

linux:~ $ gmake hello
hello
linux:~ $ gmake goodbye
goodbye

Clearly I can now pass a command line argument to a generic target.

Comments are closed.