views:

188

answers:

8

A sysadmin teacher told me one day that I should learn to use "make" because I could use it for a lot of other things that just triggering complilations.

I never got the chance to talk longer about it. Do you have any good example ?

As a bonus, isn't it this tool deprecated, and what are modern alternatives (for the compilation purpose and others) ?

A: 

The most random use I've ever seen is make being used in place of bash for init scripts on BCCD. It actually worked decently, once you got over the wtf moment....

Think of make as shell scripts with added oomph.

akdom
A: 

isn't it this tool deprecated

What?! No, not even slightly. I'm on Linux so I realise I'm not an average person, but I use it almost daily. I'm sure there are thousands of Linux devs who do use it daily.

Oli
+3  A: 

One excellent thing make can be used for besides compilation is LaTeX. If you're doing any serious work with LaTeX, you'll find make very handy because of the need to re-interpret .tex files several times when using BibTex or tables of contents.

Make is definitely not deprecated. Although there are different ways of doing the same thing (batch files on Windows, shell scripts on Linux) make works the best, IMHO.

iansinke
I'll second this. Having a good makefile for a large LaTeX project is a real timesaver.
Antti Rasinen
+1  A: 

Make can be used to execute any commands you want to execute. It is best used for activities that require dependency checking, but there is no reason you couldn't use make to check your e-mail, reboot your servers, make backups, or anything else.

Ant, NAnt, and msbuild are supposedly the modern alternatives, but plain-old-make is still used extensively in environments that don't use Java or .NET.

Kristopher Johnson
A: 

Well, I sure that the UNIX tool "make" is still being used a lot, even if it's waning in the .Net world. And while more people may be using MSBUILD, Ant, nAnt, and others tools these days, they are essentially just "make" with a different file syntax. The basic concept is the same.

Make tools are handy for anything where there's an input file which is processed into an output file. Write your reports in MSWord, but distribute them as PDFs? -- use make to generate the PDFs.

James Curran
A: 

Configuration file changes through crontab, if needed.

I have examples for postfix maps, and for squid external tables.

Example for /etc/postfix/Makefile:

POSTMAP=/usr/sbin/postmap
POSTFIX=/usr/sbin/postfix

HASHES=transport access virtual canonical relocated annoying_senders
BTREES=clients_welcome

HASHES_DB=${HASHES:=.db}
BTREES_DB=${BTREES:=.db}

all: ${BTREES_DB} ${HASHES_DB} aliases.db
    echo \= Done

${HASHES_DB}: %.db: %
    echo . Rebuilding $< hash...
    ${POSTMAP} $<

${BTREES_DB}: %.db: %
    echo . Rebuilding $< btree...
    ${POSTMAP} $<

aliases.db: aliases
    echo . Rebuilding aliases...
    /usr/bin/newaliases

etc

ΤΖΩΤΖΙΟΥ
A: 

I remember seeing an article on Slashdot a few years ago describing a technique for optimising Linux boot sequence by using make.

edit:

Here's an article from IBM explaining the principle.

therefromhere
+1  A: 

Make performs a topological sort, which is to say that given a bunch of things, and a set of requirements that one thing be before another thing, it finds a way to order all of the things so that all of the requirements are met. Building things (programs, documents, distribution tarballs, etc.) is one common use for topological sorting, but there are others. You can create a Makefile with one entry for every server in your data center, including dependencies between servers (NFS, NIS, DNS, etc.) and make can tell you what order in which to turn on your computers after a power outage, or what order to turn them off in before a power outage. You can use it to figure out what order in which to start services on a single server. You can use it to figure out what order to put your clothes on in the morning. Any problem where you need to find an order of a bunch of things or tasks that satisfies a bunch of specific requirements of the form A goes before B is a potential candidate for being solved with make.

Glomek