# Copyright Notices

# This software was developed for use by the U.S. Government as
# represented by the Administrator of the National Aeronautics and
# Space Administration. No copyright is claimed in the United States
# under 17 U.S.C. 105.

# This software may be used, copied, and provided to others only as
# permitted under the terms of the contract or other agreement under
# which it was acquired from the U.S. Government.  Neither title to nor
# ownership of the software is hereby transferred.  This notice shall
# remain on all copies of the software.

include ../../commonMakeOptions.imake

DIRFLAG += -I$(EUROPA_DIR)/TokenNetwork -I$(EUROPA_DIR)/Planners -I$(EUROPA_DIR)/SearchLibrary -I$(EUROPA_DIR)/ConstraintNetwork

all:	simplePlan$(EXE)
	echo $@ > $@

OBJECTS=simplePlan.o StackBasedPlanner.o PlanUtil.o PartialPlanWriter.o

simplePlan$(EXE): $(OBJECTS) $(EUROPA_DIR)/libeuropa.$(XLOF)
	$(PURIFY) $(CC) $(CFLAGS) $(LINKEXEFLAG) -o $@ $(OBJECTS) $(EUROPA_LIB) $(PARSER_LIBS) $(LIBS) $(LD_R_LIST)

simplePlan.a: $(OBJECTS)
	$(AR) $@ $?
	ranlib $@

simplePlan.so: $(OBJECTS)
	$(LD) $(LDFLAG) -o $@ $(OBJECTS) $(LIBS)

tests:	all ALWAYS
	cd $(EUROPA_DIR)/ModuleTests/Parser && $(MAKE) PLANNER=$(EUROPA_DIR)/Planners/SimplePlanner/simplePlan$(EXE) tests
	echo $@ > $@

longTests: tests
	cd $(EUROPA_DIR)/ModuleTests/Parser && $(MAKE) PLANNER=$(EUROPA_DIR)/Planners/SimplePlanner/simplePlan$(EXE) longTests
	echo $@ > $@

$(EUROPA_DIR)/libeuropa.$(XLOF):
	cd $(EUROPA_DIR) && $(MAKE) libeuropa.$(XLOF)

ALWAYS:

clean:
	/bin/rm -f simplePlan$(EXE) *.o all clean depend planner.cc planner.hh simplePlan.o PlanUtil.cc
	/bin/rm -f longTests tests longTests.simplePlan isTokNetValid.o

PlanUtil.cc: $(EUROPA_DIR)/Planners/PlanUtil.cc
	rm -f $@
	ln -s $? $@

ifeq (,$(EUROPA_VERSION_HH_DONE))
$(EUROPA_DIR)/Includes/version.hh: ALWAYS
	cd $(EUROPA_DIR) && $(MAKE) Includes/version.hh
else
$(EUROPA_DIR)/Includes/version.hh:
	cd $(EUROPA_DIR) && $(MAKE) Includes/version.hh
endif

depend: makefile *.cc PlanUtil.cc $(EUROPA_DIR)/Includes/version.hh
	rm -f planner.cc planner.hh
	$(DEPEND)
	test -s $@

include depend
