# BlinkenLib # Copyright 2004-2016 Stefan Schuermans # Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html # a blinkenarea.org project CC:=gcc INCDIR:=-I/sw/include LIBDIR:=-L/sw/lib CFGS:=$(addsuffix .cfg,win osx mng gif gif4 gif5) .PHONY: all clean .SUFFIXES: SUFFIXES:= .SECONDARY: all: config.cfg config.mk config.h win.cfg: if echo '#include ' | $(CC) -E -x c - >/dev/null 2>/dev/null; then echo "WIN=1"; else echo "WIN=0"; fi >$@ osx.cfg: echo "OSX=" | tr -d '\n' >$@ (if [ "$$(uname -s)" == "Darwin" ]; then echo "1"; else echo "0"; fi) >>$@ mng.cfg: echo "MNG=" | tr -d '\n' >$@ (($(CC) $(INCDIR) $(LIBDIR) -o mng mng.c -lmng && ./mng && echo "1") || echo "0") >>$@ rm -f mng gif%.cfg: echo "GIF$*=" | tr -d '\n' >$@ (($(CC) $(INCDIR) $(LIBDIR) -o gif$* gif$*.c -lgif && ./gif$* && echo "1") || echo "0") >>$@ rm -f gif$* gif.cfg: gif4.cfg gif5.cfg echo "GIF=" | tr -d '\n' >$@ ((cat $^ | grep -q 1 && echo "1") || echo "0") >>$@ config.cfg: $(CFGS) cat $^ >config.cfg config.mk: config.cfg sed 's/^\([A-Z0-9]*\)=\([01]\)$$/BLINKENLIB_CFG_\1:=\2/' <$< >$@ config.h: config.cfg Makefile ../version.mk sed 's/^\([A-Z0-9]*\)=0$$/#undef BLINKENLIB_CFG_\1/;s/^\([A-Z0-9]*\)=1$$/#define BLINKENLIB_CFG_\1/' <$< >$@ echo '#define BLINKENLIB_CONFIG "' | tr -d '\n' >>$@ sed 's/^\([A-Z0-9]*\)=0$$/\1-/;s/^\([A-Z0-9]*\)=1$$/\1+/' <$< | tr '\n' ' ' | sed 's/ *$$//' | tr -d '\n' >>$@ echo '"' >>$@ grep '^VERSION_[A-Z]*:=[0-9]*' ../version.mk | sed 's/^/#define BLINKENLIB_/;s/:=/ /' >>$@ clean: rm -f $(CFGS) config.cfg config.mk config.h