.SUFFIXES: .o .C .c  .cpp

include mkfiles


##################################################################

include ../../sys/config/mkflags

##################################################################
CC = g++
CC1 = gcc

CPPOBJECTS =$(CPPOBJS:%= $(OBJDIR)/%)
CCOBJECTS =$(CCOBJS:%= $(OBJDIR)/%)
CPPOBJECTS2 =$(CPPOBJS:%= $(OBJDIR2)/%)
CCOBJECTS2 =$(CCOBJS:%= $(OBJDIR2)/%)

#.c.o:
#	$(CC1) $(C++FLAGS) -c $(*F).c  -o $(OBJDIR)/$*.o
#
#.C.o:
#	$(CC) $(C++FLAGS) -c $(*F).C   -o $(OBJDIR)/$*.o
#
#.cpp.o:
#	$(CC) $(C++FLAGS) -c $(*F).cpp -o $(OBJDIR)/$*.o
#

LIBDLLBASE  = $(LIBNAME)
#LIBDLL  = $(LIBNAME).$(VERSION).d
#LIBDLL2 = $(LIBNAME).$(VERSION)
LIBDLL  = libwsnsplugind$(VERSION).dll
LIBDLL2 = libwsnsplugin$(VERSION).dll
LIBST   = $(LIBNAMED2)
LIBST2  = $(LIBNAME2)
RANLIB = ranlib

#all: $(LIBDIR)/$(LIBDLL) $(LIBDIR)/$(LIBDLL2) $(LIBDIR)/$(LIBST) $(LIBDIR)/$(LIBST2)
all: runtime
static: $(LIBDIR)/$(LIBST2)
static-debug: $(LIBDIR)/$(LIBST)
debug: $(LIBDIR)/wsnsplugind.o
runtime: $(LIBDIR)/wsnsplugin.o

$(LIBDIR)/wsnsplugind.o: $(CPPOBJECTS) $(CCOBJECTS)
	$(CC) $(STFLAGS) -o $(LIBDIR)/wsnsplugind.o $(CPPOBJECTS) $(CCOBJECTS)

$(LIBDIR)/wsnsplugin.o: $(CPPOBJECTS2) $(CCOBJECTS2)
	$(CC) $(STFLAGS) -o $(LIBDIR)/wsnsplugin.o $(CPPOBJECTS2) $(CCOBJECTS2)

$(LIBDIR)/$(LIBST): $(CPPOBJECTS) $(CCOBJECTS)
	$(STLD) $(STFLAGS) -o $(OBJDIR)/master_obj.o $(CPPOBJECTS) $(CCOBJECTS)
	ar -rv $(LIBDIR)/$(LIBST) $(OBJDIR)/master_obj.o
	$(RANLIB) $(LIBDIR)/$(LIBST)

$(LIBDIR)/$(LIBST2): $(CPPOBJECTS2) $(CCOBJECTS2)
	$(STLD) $(STFLAGS) -o $(OBJDIR2)/master_obj.o  $(CPPOBJECTS2) $(CCOBJECTS2)
	ar -rv $(LIBDIR)/$(LIBST2) $(OBJDIR2)/master_obj.o
	$(RANLIB) $(LIBDIR)/$(LIBST2)


$(OBJDIR)/%.o:%.cpp
	$(CC) $(C++FLAGS_DLL) $(XINCS) $(KINPUT2) -c $(*F).cpp -o $(OBJDIR)/$*.o -D_WINDOWS -D_MSC_VER -DXP_PC
$(OBJDIR)/%.o:%.c
	$(CC1) $(C++FLAGS_DLL) $(XINCS) $(KINPUT2) -c $(*F).c   -o $(OBJDIR)/$*.o -D_WINDOWS -D_MSC_VER -DXP_PC
$(OBJDIR2)/%.o:%.cpp
	$(CC) $(C++FLAGS2_DLL) $(XINCS) $(KINPUT2) -c $(*F).cpp -o $(OBJDIR2)/$*.o -D_WINDOWS -D_MSC_VER -DXP_PC
$(OBJDIR2)/%.o:%.c
	$(CC1) $(C++FLAGS2_DLL) $(XINCS) $(KINPUT2) -c $(*F).c   -o $(OBJDIR2)/$*.o -D_WINDOWS -D_MSC_VER -DXP_PC

#$(CPPOBJECTS):
#	$(CC) $(C++FLAGS) -c $(*F).cpp -o $*.o
#
#$(CCOBJECTS):
#	$(CC) $(C++FLAGS) -c $(*F).c -o $*.o


clean:
	rm.exe -f $(CPPOBJECTS) $(CCOBJECTS) $(CPPOBJECTS2) $(CCOBJECTS2) *.bak
	rm.exe -f $(LIBDIR)/$(LIBDLL) $(LIBDIR)/$(LIBDLL2) 
	rm.exe -f $(LIBDIR)/$(LIBST) $(LIBDIR)/$(LIBST2)
	rm.exe -f $(LIBDIR)/$(LIBNAMED)
	rm.exe -f $(LIBDIR)/$(LIBNAME)
	rm.exe -f $(OBJDIR)/master_obj.o
	rm.exe -f $(OBJDIR2)/master_obj.o



