# sup2vob — PGS (.sup) -> VobSub (.sub/.idx) converter
#
# Build:  make        -> ./sup2vob
# Clean:  make clean

SWIFTC   ?= swiftc
OPTFLAGS ?= -O
TARGET   := sup2vob
PREFIX   ?= /usr/local
SOURCES  := $(wildcard *.swift)

.PHONY: all clean rebuild install

all: $(TARGET)

$(TARGET): $(SOURCES)
	$(SWIFTC) $(OPTFLAGS) -o $(TARGET) $(SOURCES)

clean:
	rm -f $(TARGET)

rebuild: clean all

# extractsubs resolves sup2vob from PATH, so a rebuild only takes effect once
# installed (usually: sudo make install).
install: $(TARGET)
	install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)
