# Makefile fragment for defining standard rules for various tools INCLUDED_STDRULES = YES # $(call make-depend,source,object,depend,flags) define make-depend @${CC} ${CFLAGS} $4 -M $1 > $3 2> /dev/null @${SED} -i -e 's,$(basename $2).o *:,$2:,' $3 endef # $(call make-depend,source,object,depend) ifeq (GNU,${TOOLCHAIN}) define make-cpp-depend @${C++} ${C++FLAGS} -M $1 > $3 2> /dev/null @${SED} -i -e 's,$(basename $2).o *:,$2:,' $3 endef else define make-cpp-depend endef endif .SUFFIXES: .o .oz .s .c .h .c++ .cpp # C source files -> object files .c.o: ${CC} ${CFLAGS} ${CAPPFLAGS} -o $@ $< $(call make-depend,$<,$@,$(subst .o,.d,$@),${CAPPFLAGS}) .c.oz: ${CC} ${CFLAGS} ${CMODFLAGS} ${C_MODULE} -o $@ $< $(call make-depend,$<,$@,$(subst .oz,.dz,$@),${CMODFLAGS}) # C++ source files -> object files .c++.o: ${C++} ${C++FLAGS} -o $@ $< $(call make-cpp-depend,$<,$@,$(subst .o,.d,$@)) .cpp.o: ${C++} ${C++FLAGS} -o $@ $< $(call make-cpp-depend,$<,$@,$(subst .o,.d,$@)) .c++.oz: ${C++} ${C++FLAGS} ${C_MODULE} -o $@ $< $(call make-cpp-depend,$<,$@,$(subst .oz,.dz,$@)) .cpp.oz: ${C++} ${C++FLAGS} ${C_MODULE} -o $@ $< $(call make-cpp-depend,$<,$@,$(subst .oz,.dz,$@)) # Assembler source files -> object files .s.o: ${AS} ${ASFLAGS} -depend $(subst .o,.d,$@) -o $@ $< .s.oz: ${AS} ${ASFLAGS} -depend $(subst .oz,.dz,$@) -pd "zM SETL {TRUE}" -o $@ $< # EOF