# Copyright (c) 2018, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.

INSTALL = install
INSTALL_d = $(INSTALL) -d
INSTALL_x = $(INSTALL)
INSTALL_f = $(INSTALL) -m644

.PHONY: all install clean

prefix ?= /usr
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
docdir ?= $(datarootdir)/doc/micperf

TEX_FILES = micperf_users_guide.pdf

all: $(TEX_FILES)

%.pdf: %.tex
	# generate table of content
	xelatex $<
	# generate final document
	xelatex $<

clean:
	rm -f $(TEX_FILES)

install: all
	$(INSTALL_d) $(DESTDIR)$(docdir)
	$(INSTALL_f) micperf_users_guide.pdf $(DESTDIR)$(docdir)
