#!/usr/bin/env make
#
# Generate the Makefile using both qmake and the custom rules we need to add on
# top of it.
#

# Rule to generate the qmake Makefile for building xxdiff.
QMAKE ?= qmake
MAKEDIR ?= .
QMAKEOPTS =

all: Makefile

OS := $(shell uname -s)
ifeq ($(OS),Darwin)
    # Default is an Xcode project, so force a makefile build
    export QMAKESPEC=macx-clang
endif

Makefile.qmake: $(MAKEDIR)/xxdiff.pro
	$(QMAKE) $(QMAKEOPTS) -o Makefile.qmake $<

Makefile: Makefile.qmake $(MAKEDIR)/Makefile.extra
	echo "MAKEDIR = $(MAKEDIR)" > Makefile
	cat $^ >> Makefile

