mercredi 25 mars 2015

Switch-case block inside define keyword in a single logical line in a makefile


This is the code excerpt from ghc.mk, part of Haskell source compilation. I find it different, because the author has chosen to write one function block in a single line. Is it a common practice in writing makefiles?


And I like to put echo statements in each one of the case handles for debugging, but with the current setup, I am not able to and make interprets my echo statements as shell commands.



define installLibsTo
$(call INSTALL_DIR,$2)
for i in $1; do \
case $$i in \
*.a) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
$(RANLIB_CMD) $2/`basename $$i` ;; \
*.dll) \
$(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,$2) ; \
$(STRIP_CMD) $2/`basename $$i` ;; \
*) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
esac; \
done
endef


Aucun commentaire:

Enregistrer un commentaire