# Copyright (C)  2006  Daniele Zelante

# This file is part of makroz.
# 
# makroz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# makroz is distributed in the hope that 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.
# 
# You should have received a copy of the GNU General Public License
# along with makroz; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

#@LICENSE
# $Id$

VERSION := 0
RELEASE := 0
BUILDNR := 1



PREFIX ?= /usr/local
TARBALLFILENAME ?= /dev/null

MKDIR := mkdir -p
CP := cp
CPR := cp -R
PRODUCT := makroz
DESTDIR := $(PREFIX)/include/$(PRODUCT)
DOCDIR := $(PREFIX)/share/doc/$(PRODUCT)
MV := mv

PKG := $(PRODUCT)-$(VERSION)-$(RELEASE)-$(BUILDNR)

ARCH := $(shell uname)

ifeq ($(ARCH),Linux)
	GNUNATIVE:=1
endif

ifeq ($(ARCH),NetBSD)
	GNUNATIVE:=0
endif

ifeq ($(ARCH),FreeBSD)
	GNUNATIVE:=0
endif

ifeq ($(ARCH),CYGWIN_NT-5.0)
	GNUNATIVE:=1
endif

ifneq ($(GNUNATIVE),0)
	TAR := tar
else
	TAR := gtar
endif	


all:
	@echo "Nothing to do. You can type make install."

install:
	$(MKDIR) $(DESTDIR)
	$(CP) *.mk $(DESTDIR)
	$(MKDIR) $(DOCDIR)/template
	$(CPR) template/* $(DOCDIR)/template


tarball:
	$(MKDIR) .tmp/$(PKG)
	$(TAR) --exclude 'CVS' --exclude '.*' -c -f - * | $(TAR) -x -f - -C .tmp/$(PKG)
	cd .tmp; $(TAR) --owner 0 --group 0 -zcf $(PKG).tar.gz $(PKG)
	$(MV) .tmp/*.tar.gz ..
	$(RM) -r .tmp
	echo $(PKG).tar.gz > $(TARBALLFILENAME)
	