summaryrefslogtreecommitdiff
path: root/Makefile
blob: 139f112ea955e5902841ceb7dacdfb07435815e5 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183

# $Id$

os=$(shell uname -s)
PATH := $(PATH):/usr/lib/qt4/bin/:/usr/share/qt4/bin/

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
    PERHAPS64 := $(shell uname --machine | perl -ne "print /64/ ? '64' : '';")
    LIB:= lib$(PERHAPS64)
    XTLIB= -L/usr/$(LIB) -L/usr/X11R6/$(LIB)
    XTOPT= -DUSE_XT
    QTINC=  -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/lib/qt4/include -I/usr/lib/qt4/include/QtCore -I/usr/lib/qt4/include/QtGui
    QTOPT= -D_REENTRANT -DQT_SHARED
    QTLIB= -lQtGui -lQtCore -lpthread

    CPPFLAGS = -MMD -I/usr/X11R6/include -I/usr/local/include/Ivy
    DSO_EXT = .so
    LD = g++ -shared -fPIC
    #PREFIX=/usr/local
    ifndef PREFIX
        PREFIX=/usr
        LDFLAGS = -L$(PREFIX)/$(LIB) $(XTLIB)
    else
        LDFLAGS = -L$(PREFIX)/$(LIB)/ivy $(XTLIB)
    endif
endif

CASESENSITIVE = "yes"
ifeq ($(CASESENSITIVE), "no")
	PCRE_OPT=PCRE_CASELESS
	REGCOMP_OPT=REG_ICASE
else
	PCRE_OPT=0
	REGCOMP_OPT=REG_EXTENDED	
endif
REGEXP= -DUSE_PCRE_REGEX -DPCRE_OPT=$(PCRE_OPT)
PCREINC = $(shell pcre-config --cflags)


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)

CXXFILES_QT :=  Ivy.cxx IvyApplication.cxx ivyqtloop.cxx
OBJECTS_QT := $(CXXFILES_QT:.cxx=.o)
DEPS_QT := $(CXXFILES_QT:.cxx=.d)

CXXFILES_XT :=  Ivy.cxx IvyApplication.cxx
OBJECTS_XT := Ivy_Xt.o IvyApplication.o
DEPS_XT := $(CXXFILES_XT:.cxx=.d)


LD_QUICKSTART_INFO=
GCXXINCS= 

LIBIVY = libIvy
LIBIVY_GLFW = $(LIBIVY)_glfw
LIBIVY_QT = $(LIBIVY)_Qt
LIBIVY_XT = $(LIBIVY)_Xt

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

LIBIVY_QT_SHARED = $(LIBIVY_QT)$(DSO_EXT)
LIBIVY_QT_DEPLIBS = -lX11  -lXext -lQtCore -livy -lpthread

LIBIVY_XT_SHARED = $(LIBIVY_XT)$(DSO_EXT)
LIBIVY_XT_DEPLIBS = -lX11  -lXext -lXt -lpthread



#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)
    DBG=debug
else
    CC= g++ -fPIC -O2  -Wall $(CPPFLAGS)
    DBG=
endif

default: $(LIBIVY_STATIC) $(LIBIVY_GLFW_STATIC) $(LIBIVY_SHARED) \
	 $(LIBIVY_GLFW_SHARED) $(LIBIVY_QT_SHARED) $(LIBIVY_XT_SHARED) \
	 testIvyQt testIvyXt

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


Ivy_Xt.o: Ivy.cxx
	$(CC) $(XTOPT) $< -c -o Ivy_Xt.o

ivyqtloop.o: ivyqtloop.moc

ivyqtloop.moc: ivyqtloop.h
	moc $(QTOPT) $(QTINC) -i $< -o $@

ivyqtloop.o: ivyqtloop.cxx
	$(CC) $(QTINC) $(QTOPT) -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)

$(LIBIVY_QT_SHARED) : $(OBJECTS_QT) 
	$(LD) -o $(LIBIVY_QT_SHARED) $(OBJECTS_QT)  \
	       $(LDFLAGS) $(LIBIVY_QT_DEPLIBS)

$(LIBIVY_XT_SHARED) : $(OBJECTS_XT) 
	$(LD) -o $(LIBIVY_XT_SHARED) $(OBJECTS_XT)  \
	       $(LDFLAGS) $(LIBIVY_XT_DEPLIBS)

install: default
        # 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)

install_mandriva64:  default
	# make clean; make install_mandriva64 PREFIX=/usr/local
	# make clean; make install_mandriva64 DEBUG=1 PREFIX=/usr/local
	#
	# headers
	mkdir -p /usr/local/include/Ivy
	install -m 0644 Ivy*.h /usr/local/include/Ivy
	# libs
	mkdir -p /usr/local/lib64/$(IVY)
	install -m 0644 $(LIBIVY_STATIC) /usr/local/lib64/$(DBG)
	install -m 0644 $(LIBIVY_GLFW_STATIC) /usr/local/lib64/$(DBG)
	install -m 0644 $(LIBIVY_SHARED) /usr/local/lib64/$(DBG)
	install -m 0644 $(LIBIVY_GLFW_SHARED) /usr/local/lib64/$(DBG)

LLDLIBS = -L $(XTLIB) -Wl,-rpath,$(XTLIB)  -L. -Wl,-rpath,. -L$(IVY_PATH)/src -Wl,-rpath,/usr/local/lib64 -L/usr/local/lib64

testIvyXt : testIvyXt.cxx
	g++  -g  $(CPPFLAGS) $(XTLIB) $(LLDLIBS)  -o $@  testIvyXt.cxx  -lIvy -lxtivy -lXt -lX11 -lIvy_Xt

testIvyQt.moc: testIvyQt.cxx
	moc $(QTOPT) $(QTINC) -i $< -o $@

testIvyQt : testIvyQt.cxx testIvyQt.moc
	g++  -g  $(QTOPT) $(QTINC)  $(LLDLIBS)  -o $@  testIvyQt.cxx -lIvy_Qt -livy $(QTLIB)

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

-include *.d