HC = ghc HC_MAKE = $(HC) -Wall --make $< -o $@ -main-is $(notdir $@) $(HC_OPTIONS) EXAMPLES=Examples TupleExample Alarm AlarmSpecialized AlarmMapValue SCREENSHOT_DIR=screenshots all:$(EXAMPLES) %: %.hs $(HC_MAKE) Examples:Examples.hs TupleExample.hs .PHONY: clean remake remake:clean all clean: - rm *.hi *.o *~ $(EXAMPLES) define makeScreenshot echo "Doing $(1) screenshot" ./$(1) & sleep 2 && import -frame -window $(2) $(SCREENSHOT_DIR)/$(1)Screenshot.png killall $(1) endef screenshots: all - rm -rf $(SCREENSHOT_DIR) mkdir $(SCREENSHOT_DIR) $(call makeScreenshot,TupleExample,"Tuple Example") $(call makeScreenshot,Alarm,"Alarm Example") $(call makeScreenshot,AlarmSpecialized,"Alarm Specialized Example") $(call makeScreenshot,AlarmMapValue,"Alarm Map Value")