summaryrefslogtreecommitdiff
path: root/Makefile
blob: 4cace6284193705a2c0ce56bcdb842af616f9fe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

# $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
else
CPPFLAGS = -MMD -I/usr/X11R6/include
DSO_EXT = .so
LD = g++ -shared
LDFLAGS = -L/usr/X11R6/lib
PREFIX=/usr
endif


CXXFILES := Ivy.cxx IvyApplication.cxx
OBJECTS := $(CXXFILES:.cxx=.o)
DEPS := $(CXXFILES:.cxx=.d)

CXXFILES_GLFW := Ivy_glfw.cxx IvyApplication.cxx
OBJECTS_GLFW := $(CXXFILES_GLFW:.cxx=.o)
DEPS_GLFW := $(CXXFILES_GLFW:.cxx=.d)


LD_QUICKSTART_INFO=
GCXXINCS= 

LIBIVY = libIvy
LIBIVY_GLFW = $(LIBIVY)_glfw

LIBIVY_STATIC = $(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')
	XTLIB = -L/usr/X11R6/lib/ 
else
	XTLIB = -L/usr/X11R6/lib64/
endif

#a mettre dans les makefiles generant les executables
#LLDLIBS=   -rpath. -L. -lTextureLabel -lInventor -lInventorXt -lXm -lXt -lttf -lGL -lGLU -lm 


ifdef DEBUG
CC= g++ -fPIC -g -Wall -pg $(CPPFLAGS)
else
CC= g++ -fPIC -O2  -Wall $(CPPFLAGS)
endif

default: $(LIBIVY_STATIC) $(LIBIVY_GLFW_STATIC) $(LIBIVY_SHARED) $(LIBIVY_GLFW_SHARED)

%.o: %.cxx
	$(CC) -c $<

$(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
	mkdir -p $(DESTDIR)$(PREFIX)/include/Ivy
	install -m 0644 Ivy*.h $(DESTDIR)$(PREFIX)/include/Ivy
	# libs
	mkdir -p $(DESTDIR)$(PREFIX)/lib
	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
	g++  -g  $(LDFLAGS) $(LLDLIBS)  -o $@  testIvy.cxx  -lIvy -lxtivy -lXt -lX11


distclean clean : 
	rm -f $(LIBIVY_STATIC) $(LIBIVY_GLFW_STATIC) $(LIBIVY_SHARED) \
		$(LIBIVY_GLFW_SHARED) $(OBJECTS) $(DEPS) \
		$(OBJECTS_GLFW) $(DEPS_GLFW) core *.o *.d *~

-include *.d