#! /usr/bin/make -f
# Creates patching scripts for all patches in the dev300 directory
# Usage:
#  mkdir patchdir && cd patchdir
#  ...<pathtothisdev300>/scriptify-all -sj
# This will generate all migration scripts in the current directory.
# Copyright LGPLv3 (or later) / MPL 2011 Canonical Ltd.

DEV300DIR := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
ALLPATCHES := $(patsubst $(DEV300DIR)/%,%,$(wildcard $(DEV300DIR)/*.diff))
ALLSCRIPTS := $(patsubst %.diff,migrate-%,$(ALLPATCHES))
SHELL=/bin/sh

all : $(ALLSCRIPTS)
	true

migrate-% : $(DEV300DIR)/%.diff $(DEV300DIR)/apply
	cd $(DEV300DIR) && awk -f extractapplyinfo.awk -v PATCHNAME=$*.diff apply > $(abspath $@)

.PHONY: all
