
# SimParm: Simple and flexible C++ configuration framework
# Copyright (C) 2007 Australian National University
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# 
# This library 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
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# 
# Contact:
# Kevin Pulo
# kevin.pulo@anu.edu.au
# Leonard Huxley Bldg 56
# Australian National University, ACT, 0200, Australia


ifeq ($(COMPILER),gcc)
CXX = g++
CXXFLAGS = -Wall
CXXFLAGS += -Wextra
#CXXFLAGS += -Werror
#CXXFLAGS += -pedantic
CXXFLAGS += -ansi
CXXFLAGS += -ggdb
CXXFLAGS += -O2
LDLIBS = -lm
else ifeq ($(COMPILER),intel)
CXX = icpc
CXXFLAGS = -g
CXXFLAGS += -O2
CXXFLAGS += -ipo
LDLIBS = -lm
endif


OBJS  = ConfigEntry.o
OBJS += ConfigSet.o
OBJS += ConfigSetOutputPrefix.o
OBJS += ConfigSetOutputTabulated.o

INCLUDES  = ConfigEntry.hh
INCLUDES += ConfigSet.hh
INCLUDES += ConfigSetOutputPrefix.hh
INCLUDES += ConfigSetOutputTabulated.hh

LIBS  = libsimparm.a
LIBS += libsimparm.so.1.0.0
LIBS += libsimparm.so.1
LIBS += libsimparm.so

all: $(LIBS)

libsimparm.a: $(OBJS)
	$(AR) cru $@ $^
	$(RANLIB) $@

libsimparm.so.1.0.0: $(OBJS)
	$(CXX) -shared -Wl,-soname -Wl,libsimparm.so.1 $(CXXFLAGS) -o $@ $^ $(LDLIBS)

libsimparm.so.1: libsimparm.so.1.0.0
	$(LN_S) $< $@

libsimparm.so: libsimparm.so.1
	$(LN_S) $< $@

install:
	$(INSTALL) -m 0755 -d $(LIB_PREFIX)
	$(INSTALL) -m 0755 -d $(INCLUDE_PREFIX)
	$(INSTALL) -m 0755 $(LIBS) $(LIB_PREFIX)
	$(INSTALL) -m 0644 $(INCLUDES) $(INCLUDE_PREFIX)

clean:
	$(RM) -f $(OBJS) $(LIBS)


