From fb3af665bef25a9056535b8ec2b90f109ee6908c Mon Sep 17 00:00:00 2001 From: fourdan Date: Wed, 24 May 2006 13:50:33 +0000 Subject: Modification du Makefile pour generer les libs statiques et dynamiques, ajout des dependances sur les libs dynamiques pour simplifier la generation des executables qui de link avec ces libs, ajout de la cible install. --- Makefile | 68 ++++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 21 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a2af1cc..6696bf7 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,18 @@ +# $Id$ os=$(shell uname -s) ifeq ($(os),Darwin) IVY_PATH := $(HOME)/src-ext/ivy-c-3.6/src -CPPFLAGS= -MMD -I$(IVY_PATH) -DSO_EXT=.dylib -LD=g++ -dynamiclib -single_module -LDFLAGS=-L$(IVY_PATH) -L/sw/lib -framework OpenGL -framework AGL -framework Carbon +CPPFLAGS = -MMD -I$(IVY_PATH) +DSO_EXT = .dylib +LD = g++ -dynamiclib -single_module +LDFLAGS = -L$(IVY_PATH) -L/sw/lib -framework OpenGL -framework AGL -framework Carbon else -CPPFLAGS= -MMD -I/usr/X11R6/include -DSO_EXT=.so -LD=g++ -shared -LDFLAGS= +CPPFLAGS = -MMD -I/usr/X11R6/include +DSO_EXT = .so +LD = g++ -shared +LDFLAGS = -L/usr/X11R6/lib +PREFIX=/usr endif @@ -25,8 +27,19 @@ DEPS_GLFW := $(CXXFILES_GLFW:.cxx=.d) LD_QUICKSTART_INFO= GCXXINCS= -LIBIVY = libIvy.a -LIBIVY_GLFW = libIvy_glfw.a + +LIBIVY = libIvy +LIBIVY_GLFW = $(LIBIVY)_glfw + +LIBIVY_STATIC = l$(LIBIVY).a +LIBIVY_GLFW_STATIC = $(LIBIVY_GLFW).a + +LIBIVY_SHARED = $(LIBIVY)$(DSO_EXT) +LIBIVY_DEPLIBS = -livy + +LIBIVY_GLFW_SHARED = $(LIBIVY_GLFW)$(DSO_EXT) +LIBIVY_GLFW_DEPLIBS = -lglfw -livy -lX11 -lXext -lXxf86vm -lGL -lpthread + PERHAPS64= `uname -m | perl -ne "print /64/ ? '64' : '';"` ifeq ($(PERHAPS64), '64') @@ -45,21 +58,34 @@ else CC= g++ -fPIC -O2 -Wall $(CPPFLAGS) endif -default: $(LIBIVY) $(LIBIVY_GLFW) +default: $(LIBIVY_STATIC) $(LIBIVY_GLFW_STATIC) $(LIBIVY_SHARED) $(LIBIVY_GLFW_SHARED) %.o: %.cxx $(CC) -c $< -$(LIBIVY) : $(OBJECTS) - ar rv $(LIBIVY) $(OBJECTS) - ranlib $(LIBIVY) - -$(LIBIVY_GLFW) : $(OBJECTS_GLFW) - ar rv $(LIBIVY_GLFW) $(OBJECTS_GLFW) - ranlib $(LIBIVY_GLFW) - - - +$(LIBIVY_STATIC) : $(OBJECTS) + ar rv $(LIBIVY_STATIC) $(OBJECTS) + ranlib $(LIBIVY_STATIC) + +$(LIBIVY_GLFW_STATIC) : $(OBJECTS_GLFW) + ar rv $(LIBIVY_GLFW_STATIC) $(OBJECTS_GLFW) + ranlib $(LIBIVY_GLFW_STATIC) + +$(LIBIVY_SHARED) : $(OBJECTS) + $(LD) -o $(LIBIVY_SHARED) $(OBJECTS) $(LDFLAGS) $(LIBIVY_DEPLIBS) + +$(LIBIVY_GLFW_SHARED) : $(OBJECTS_GLFW) + $(LD) -o $(LIBIVY_GLFW_SHARED) $(OBJECTS_GLFW) $(LDFLAGS) $(LIBIVY_GLFW_DEPLIBS) + +install: + # headers + install -m 0644 Ivy*.h $(DESTDIR)$(PREFIX)/include/Ivy + # libs + install -m 0644 $(LIBIVY_STATIC) $(DESTDIR)$(PREFIX)/lib + install -m 0644 $(LIBIVY_GLFW_STATIC) $(DESTDIR)$(PREFIX)/lib + install -m 0644 $(LIBIVY_SHARED) $(DESTDIR)$(PREFIX)/lib + install -m 0644 $(LIBIVY_GLFW_SHARED) $(DESTDIR)$(PREFIX)/lib + LLDLIBS = -L $(XTLIB) -Wl,-rpath,$(XTLIB) -L. -Wl,-rpath,. -L$(IVY_PATH)/src testIvy : testIvy.cxx -- cgit v1.1