Makefile with LaTeX dir

Viewed 59

It is a long time ago, that I worked with GNU make, since then I forgot a lot. :-(

I have a project, containing some shell scripts and an extra directory with LaTeX documentation.

The diretory structure could look like this

.../topdir/
      |
      |-Makefile
      |
      |--data/
      |    |-filea
      |    |-fileb
      |
      |--latex/
      |    |-example.tex
      |    |-awesome-style.sty
      |    |-imagea.png
      |    |-Makefile

In that latex-directory exists a Makefile which is working alright, when I cd into the directory and call make clean or make example ...

Now, I want the Makefile in the topdir to be the master makefile. When I am in that directory and say e.g. make example the recipe should be, to change into the latex directory and run make from there, hence using latex/Makefile.

EDIT Of course, when I say make clean in the topdir Makefile, I want the it to also run make clean in the latex dir.

What is the correct trick? What must I write in the master makefile?

1 Answers

Just:

example:
        $(MAKE) -C latex
clean:
        $(MAKE) -C latex clean

.PHONY: example clean

will what you asked for. The .PHONY is optional but a good idea.

Related