# GEOMLIB2D subdirectory Makefile

# Copyright (C) 1998  Cliff Johnson                                       #
#                                                                         #
# 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 software 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 software (see COPYING.LIB); if not, write to the        #
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #

FREEROOT=..
include $(FREEROOT)/Makefile.in

CFLAGS+= -fPIC 

SRCS = 	circle.cpp \
	entity.cpp \
	cadlib2d.cpp \
	line.cpp \
	point.cpp \
	segment.cpp \
	arc.cpp \
	pick.cpp \
	pickentity.cpp \
	entityexception.cpp 

OBJS = $(SRCS:%.cpp=%.o)

all : library

library: $(OBJS)
	$(CXX) -shared -Wl,-soname,libCad2D.so.0 -o libCad2D.so.0.3 $(OBJS)
	ln -sf libCad2D.so.0.3 libCad2D.so.0
	ln -sf libCad2D.so.0 libCad2D.so

%.o : %.cpp
	$(CXX) $*.cpp  $(CFLAGS) -c

testlibshared  : clean testlib.cpp library
	$(CXX) testlib.cpp -g -Wall -L. -lGeom2D -o testlibshared

testliblinked : clean testlib.cpp $(OBJS)
	$(CXX) testlib.cpp -g -Wall $(OBJS) -o testliblinked

testlibstatic : clean testlib.cpp $(OBJS)
	$(CXX) testlib.cpp -g -static -Wall $(OBJS) -o testlibstatic

testarc : testarc.cpp arc.o point.o entity.o circle.o
	$(CXX) testarc.cpp arc.o point.o entity.o circle.o $(CFLAGS) -o testarc 


clean : 
	rm -f *.o testlibstatic testlibshared testliblinked testlib testarc libCad2D.so.* 

vimclean: clean
	rm -f *~
