OCAMLFIND_META_DIR = @OCAMLFIND_META_DIR@
METAS = $(MODULES:%=METAS/META.helm-%)
-CWD=`pwd`
+CWD := $(shell pwd)
+OCAMLPATH = $(CWD)/METAS/
all: metas $(MODULES:%=%.all)
opt: metas $(MODULES:%=%.opt)
.PHONY: all opt world metas depend install uninstall clean clean_metas distclean
-$(MODULES:%=%.all):
- export OCAMLPATH=$(CWD):$$OCAMLPATH ; cd $(@:%.all=%) && make all
-$(MODULES:%=%.opt):
- export OCAMLPATH=$(CWD):$$OCAMLPATH ; cd $(@:%.opt=%) && make opt
-$(MODULES:%=%.depend):
- export OCAMLPATH=$(CWD):$$OCAMLPATH ; cd $(@:%.depend=%) && make depend
+%.all:
+ OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH $(MAKE) -C $* all
+%.opt:
+ OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH $(MAKE) -C $* opt
+%.clean:
+ OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH $(MAKE) -C $* clean
+%.depend:
+ OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH $(MAKE) -C $* depend
+
$(MODULES:%=%.install):
cd $(@:%.install=%) && make install
export TARGET=$(OCAMLFIND_META_DIR)/$(@:%.install=META.helm-%) ; \
$(MODULES:%=%.uninstall):
cd $(@:%.uninstall=%) && make uninstall
rm -f $(OCAMLFIND_META_DIR)/$(@:%.uninstall=META.helm-%)
-$(MODULES:%=%.clean):
- cd $(@:%.clean=%) && make clean
METAS/META.helm-%: METAS/meta.helm-%.src
cp $< $@ && echo "directory=\"$(CWD)/$*\"" >> $@