#######################################################################
#
#  Copyright (C) 2004 Novell, Inc.
#
#  This program 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.
#
#  This program 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 this program; if not, write to the Free
#  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#  Author: Greg Richardson <grichardson@novell.com>
#
#######################################################################

SUBDIRS =

DIST_SUBDIRS =

EXTRA_DIST = UpdateWarFile.java

if DEBUG
TARGET_CFG = Debug
DEBUG = -g
else
TARGET_CFG = Release
DEBUG = -g:none
endif

PACKAGE = UpdateWarFile
TARGET_FILE = $(PACKAGE).class
LOG_FILE = $(PACKAGE).log
JAVAFILES = UpdateWarFile.java 
BUILDDIR = bin/$(TARGET_CFG)
CLASSES = $(addprefix $(BUILDDIR)/, $(JAVAFILES:%.java=%.class))

.PHONY: package package-clean package-install package-uninstall

all: $(BUILDDIR) $(CLASSES)

$(BUILDDIR)/%.class: %.java
	@rm -f $(LOG_FILE) $@
	@echo [======== Compiling $@ ========]
	@javac $(DEBUG) -d $(BUILDDIR) $< 2> $(LOG_FILE)
	@echo $$CMD; \
	if eval $$CMD; then \
		ls -l $(BUILDDIR)/$(TARGET_FILE); \
		cp $(BUILDDIR)/$(TARGET_FILE) bin; \
	else \
		grep -a "ERROR:" $(LOG_FILE); \
	fi

$(BUILDDIR):
	[ -d $(BUILDDIR) ] || mkdir -p $(BUILDDIR)

	
package-clean clean-local:
	rm -rf  bin/Release/* bin/Release bin/Debug/* bin/Debug bin/* bin *.log

clean:
	rm -rf  bin/Release/* bin/Release bin/Debug/* bin/Debug bin/* bin *.log

distclean-local: package-clean
	rm -f Makefile

maintainer-clean-local:
	rm -f Makefile.in