all: $(wildcard *.msg) .%.header: % sed -e '/^$$/ q' $< | grep -v '^$$' | iconv -futf8 -tlatin1 > $@ .%.body: % sed -e '1,/^$$/ d' $< | iconv -futf8 -tlatin1 > $@ %.msg: .%.header .%.body cat .$(subst .msg,,$@).header > $@ mime-construct --output \ --type "text/plain; charset=latin1" \ --file .$(subst .msg,,$@).body >> $@ rm -f $^