##
# gdm2s3m Makefile fragment
##

.PHONY: ${gdm2s3m}_clean

.SUFFIXES: .c

gdm2s3m_src = contrib/gdm2s3m/src
gdm2s3m_obj = contrib/gdm2s3m/src/.build

gdm2s3m_cflags := -W -Wmissing-format-attribute -Wpointer-arith -Wcast-align
gdm2s3m_cflags += -Wwrite-strings -I${gdm2s3m_src}

gdm2s3m_objs = \
    ${gdm2s3m_obj}/error.o ${gdm2s3m_obj}/gdm.o \
    ${gdm2s3m_obj}/s3m.o ${gdm2s3m_obj}/utility.o \
    ${gdm2s3m_obj}/gdm2s3m.o

${gdm2s3m_obj}/%.o: ${gdm2s3m_src}/%.c
	$(if ${V},,@echo "  CC      " $<)
	${CC} -MD ${CFLAGS} ${gdm2s3m_cflags} -c $< -o $@

-include $(gdm2s3m_objs:.o=.d)

${gdm2s3m_objs}: $(filter-out $(wildcard ${gdm2s3m_obj}), ${gdm2s3m_obj})

gdm2s3m_clean:
	$(if ${V},,@echo "  RM      " ${gdm2s3m_obj})
	${RM} -r ${gdm2s3m_obj}
