[mercury-users] Recursive make considered harmful

Peter Ross pro at missioncriticalit.com
Tue Nov 8 01:17:14 AEDT 2005


Hi,

I've just been reading "Recursive make considered harmful" [1] and since
we are having similar problems with our build process, I thought I would
try and implement the ideas from it using mmake.

I was 90% successful with the following file structure and the following
Mmakefile.

*-
 +- Mmakefile
 +- ant
  +- main.m
 +- bee
  +- hello.m

Mmakefile
=========
MAIN_TARGET=build

MODULES := ant bee
SRC :=

include $(patsubst %,%/module.mk,$(MODULES))

CS := $(notdir $(patsubst %.m,%.c,$(SRC)))

OBJ := $(patsubst %.m,%.o,$(SRC))
LOBJ := $(notdir $(OBJ))

build: init.o $(LOBJ)
        ml -- -o main init.o $(LOBJ)

include $(OBJ:.o=.myd)

%.myd: %.m
	mmc --generate-dependencies $*.m
	rm $(notdir $*.dep $*.dv)
	mv $(notdir $*.d) $*.myd

init.c: $(CS)
	c2init --init-c-file init.c $(CS)


ant/module.mk
=============
SRC += ant/main.m

bee/module.mk 
=============
SRC += ant/hello.m

This builds but there are some problems.

The first is that there is no option to just build the .d file, instead
I hack around this by using --generate-dependencies to do it for me.

The second problem is that in the above the .d is in the wrong
directory, however I think that is more a problem with my definition
of the Mmakefile.

Anyway I was intending to add the generate-dependency-file option for
building the '.d' file, but I was curious as to other peoples reactions
to this scheme and how we could improve on this first cut.

Cheers,
Pete



[1] http://www.pcug.org.au/~millerp/rmch/recu-make-cons-harm.html


-- 
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list