I seem to remind you that you can call make recursively, something like:
all: -mkdir $(TEMPDIR) $(MAKE) $(MLAGS) old_all -rm -rf $(TEMPDIR) old_all: ... rest of stuff.
I did similar tricks for creating in subdirectories:
all: @for i in $(SUBDIRS); do \ echo "make all in $$i..."; \ (cd $$i; $(MAKE) $(MLAGS) all); \ done
Just checked and this works fine:
$ cat Makefile all: -mkdir tempdir -echo hello >tempdir/hello -echo goodbye >tempdir/goodbye $(MAKE) $(MFLAGS) old_all -rm -rf tempdir old_all: ls -al tempdir $ make all mkdir tempdir echo hello >tempdir/hello echo goodbye >tempdir/goodbye make old_all make[1]: Entering directory '/home/pax' ls -al tempdir total 2 drwxr-xr-x+ 2 allachan None 0 Feb 26 15:00 . drwxrwxrwx+ 4 allachan None 0 Feb 26 15:00 .. -rw-r--r-- 1 allachan None 8 Feb 26 15:00 goodbye -rw-r--r-- 1 allachan None 6 Feb 26 15:00 hello make[1]: Leaving directory '/home/pax' rm -rf tempdir $ ls -al tempdir ls: cannot access tempdir: No such file or directory
paxdiablo
source share