###
# Test GNU Makefile.
# $Id$
###

# Include the common makefile
include ../../../Makefile.common

# List of c++ files.  Each of these will be treated as a "main" app.
CPPSRCS=$(wildcard *.cpp)

# Strip off the .cpp
PROGRAMS=$(patsubst %.cpp,%,$(CPPSRCS))

# replace .cpp with .o
OBJS=$(patsubst %.cpp,%.o,$(CPPSRCS))

all: $(OBJS) $(PROGRAMS)

# $(PROGRAMS): $(OBJS)

clean:
	$(RM_CMD) $(PROGRAMS) *~

depends: $(CPPSRCS:.cpp=.d)

# Pattern rule for objects from .cpp files.
%.o: %.cpp
	$(CXX) $(CXXFLAGS) $(CDEBUGFLAGS) $(BASE_DEFINES) $(BASE_INCLUDES) $(LDFLAGS_APP) -c $< -o $@

%: %.o
	$(CXX) $(CXXFLAGS) $(CDEBUGFLAGS) $(BASE_DEFINES) $(BASE_INCLUDES) $(LDFLAGS_APP) $@.o $(OSSIM_APP_LINK) -o $@

# Pattern rule for depends ".d" from ".cpp" file.
%.d: %.cpp
	$(SHELL) -ec '$(CXX) -MM $(CXXFLAGS) $(CDEBUGFLAGS) $(BASE_DEFINES) $(LDFLAGS_APP) $< > $@;'
