1#
2# DRAWxtl V5.5 makefile using the Fast Light Tool Kit (FLTK).
3#
4# Copyright 2007-2011 by Larry Finger, Martin Kroeker, and Brian Toby
5#
6
7OPTIM = error
8TARGET = ../../exe/DRAWxtl55
9PREINC =
10RESFILE =
11
12# post processing command - overwritten for Mac
13POSTLINK = touch
14
15OS=$(shell uname)
16
17# Cygwin produces a string of the form CYGWIN_dd-x.y where dd is NT 95 98 or ME and
18#    x and y are the major and minor versions, respectively. The next 'if' will effectively
19#    truncate that to CYGWIN, no matter which version of Windows is being used. Other OS's
20#    will be unaffected.
21
22ifneq (,$(findstring CYGWIN,$(OS)))
23    OS=CYGWIN
24endif
25
26# Map all BSD variants to Linux for now (seems to work for the Debian folks at least)
27ifneq (,$(findstring BSD,$(OS)))
28    OS=Linux
29endif
30ifneq (,$(findstring DragonFly,$(OS)))
31    OS=Linux
32endif
33
34ifeq ($(OS),Linux)
35
36# section to define the various symbols needed to build DRAWxtl for Linux systems
37
38  prefix          = /usr/local
39  includedir      = ${prefix}/include
40  libdir          = ${prefix}/lib/
41
42  BUILD_CPU=$(shell uname -m)
43  ifneq (,$(findstring 64,$(BUILD_CPU)))
44      libdir	  = ${prefix}/lib/
45  endif
46
47# compiler name:
48  CXX             = g++
49
50# flags for C++ compiler:
51  OPTIM           = -g -Wall -Wunused  -fno-exceptions
52# work around a bug in freeglut 2.4 - only enable this if you have to use a version
53# of fltk before 1.1.8 AND exactly version 2.4 of freeglut
54#  GLUT		  = -DFREEGLUT24
55  CXXFLAGS        = $(OPTIM)  -I/usr/X11R6/include $(GLUT)
56
57# libraries to link with:
58  GLDLIBS  =  -L$(prefix)/lib  -lGLU -lGL -lXinerama -lXft -lpthread -lm  -lXext -lX11  -lXpm \
59		-lfltk \
60# -lglut # only needed with old versions of fltk before 1.1.8
61#       -lXi -lgdkglext-x11-1.0a  # Fedora Core 2 needs these libraries
62  LINKFLTKGL  = $(libdir)libfltk.so $(libdir)libfltk_gl.so
63
64# The extension to use for executables...
65  EXEEXT          =
66
67endif
68
69ifeq ($(OS),CYGWIN)
70
71# section to define the various symbols needed to build DRAWxtl for cygwin running on Windows
72
73  prefix          = /usr/
74  includedir      =
75  libdir          = /fltk/lib
76
77# compiler name:
78  CXX             = g++
79
80# flags for C++ compiler:
81  OPTIM           = -g -O2 -Wall -Wunused -pedantic -fno-exceptions -I /usr/i686-pc-cygwin/include/mingw
82  CXXFLAGS        =  $(OPTIM) -I /fltk -I /FLU -mno-cygwin -mwindows -DWIN32
83  PREINC 	  = -I/fltk -I/FLU
84
85# libraries to link with:
86  GLDLIBS  =  -mwindows -mno-cygwin -lglut32 -lglu32 -lopengl32 -lole32 -luuid -lcomctl32 -lwsock32 -lsupc++
87  LINKFLTKGL  = -L/FLU/lib -lflu  -L/fltk/lib -lfltk_gl -lfltk
88
89# The extension to use for executables...
90  EXEEXT          = ".EXE"
91
92  # Resource file (the icon)
93  RESFILE	  = Drawv54.rc
94
95endif
96
97ifeq ($(OS),IRIX64)               # use GNU g++ compiler on SGI
98
99# this uses the GNU g++ compiler
100# libglut was loaded from the SGI freeware site: freeware.sgi.com
101# but FLTK was built from source, since g++ and CC (MIPS c++) may be incompatible
102# source patch needed to FLTK: change fltk-1.1.5/FL/Fl_Double_Window.H
103# string  type(FL_DOUBLE_WINDOW) to type(0xF1) (two places & no, I don't understand)
104
105  prefix          = /usr/user2/toby/fltk-1.1.5
106  includedir      = ${prefix}/
107  libdir          = ${prefix}/lib
108
109  # compiler name:
110  CXX             = g++
111
112  # flags for C++ compiler:
113  OPTIM           = -g -O2 -Wall -Wunused  -fno-exceptions
114  CXXFLAGS        = $(OPTIM)
115
116  # libraries to link with:
117  GLDLIBS  =  -L/usr/freeware/lib32 -lglut -L/usr/lib32/ -lGL -lGLU -lm -lXpm -lX11
118  LINKFLTKGL  = -L$(libdir) -lfltk_gl -lfltk
119
120  # The extension to use for executables...
121  EXEEXT          =
122
123endif
124
125ifeq ($(OS),Darwin)
126
127# Mac stuff goes here
128  #prefix          = /usr/local
129  includedir      = ../../../fltk
130  libdir          = ../../../fltk/lib
131
132# compiler name:
133  CXX             = g++
134
135# flags for C++ compiler:
136  OPTIM           = -g -O2 -Wall -Wunused  -fno-exceptions
137  CXXFLAGS        = $(OPTIM)
138# in 10.2 I think I needed to add this to the above:
139# -framework AGL -framework GLUT -framework OpenGL -framework Carbon -framework ApplicationServices
140
141# libraries to link with:
142#  GLDLIBS  =  -framework AGL -framework GLUT -framework OpenGL  -framework Carbon -framework ApplicationServices -lsupc++ -lobjc
143# libsupc++ not used with gcc v4.0
144  GLDLIBS  =  -framework AGL -framework GLUT -framework OpenGL  -framework Carbon -framework ApplicationServices -lobjc
145  LINKFLTKGL  = -L$(libdir) -static -lfltk_gl -lfltk
146  PREINC 	  = -I$(includedir)
147# The extension to use for executables...
148  EXEEXT          =
149
150# post processing command
151  POSTLINK = /Developer/Tools/Rez -t APPL $(includedir)/FL/mac.r -o
152
153endif
154
155##################################################################################
156#
157# ALL Operating Specific material MUST be specified before this point
158#
159##################################################################################
160
161ifeq ($(OPTIM),error)
162  OPTIM=-O
163  CXX=cc
164  CXXFLAGS=$(OPTIM)
165  GLDLIBS=-lfltk_gl -lfltk -lglut -lGLU -lGL
166endif
167
168# Be quiet when building...
169.SILENT:
170
171# Build commands and filename extensions...
172.SUFFIXES:	.rc .cxx .h .o $(EXEEXT)
173
174.rc.o:
175	echo Building resource $< ...
176	windres Drawv54.rc Drawv54.o
177
178.cxx.o:
179	echo Compiling $< ...
180	$(CXX) -I$(includedir) $(CXXFLAGS) -c $<
181
182CPPFILES =\
183	CrystalView.cxx \
184	cursor.cxx \
185	drawmap.cxx \
186	DRAWxtl1.cxx \
187	DRAWxtl2.cxx \
188	DRAWxtl3.cxx \
189	DRAWxtlViewUI.cxx \
190	EditView.cxx \
191	Edit1.cxx \
192	Edit2.cxx \
193	Ellipsoids.cxx \
194	Flu_Combo_Box.cxx \
195	Flu_Combo_List.cxx \
196	Flu_Spinner.cxx \
197	Fourier.cxx \
198	Generate_Drawing.cxx \
199	gl2ps.cxx \
200	gl2gif.cxx \
201	Help.cxx \
202	Import.cxx \
203	MC.cxx \
204	mpVector.cxx \
205	Read_Input.cxx \
206	symmtry.cxx \
207	Tb_Window.cxx
208
209OBJFILES = $(CPPFILES:.cxx=.o) $(RESFILE:.rc=.o)
210
211all:	$(TARGET)
212
213clean:
214	-@ rm -f $(TARGET) *.o core *~ .deps ../../examples/*.{out,cns,pov,wrl,tmp,tga,lst,fl,bmp} \
215		*.orig *.rej
216
217# Define the dependencies of the object files on the header files
218
219.deps:  $(CPPFILES)
220	echo "Building dependencies..."
221	echo >.deps
222	for i in $(CPPFILES); do gcc $(CFLAGS) -MM $(PREINC) $$i >>.deps; done
223
224-include .deps
225
226# DRAWxtl
227
228$(TARGET) : .deps $(OBJFILES)
229	echo Linking $@...
230	mkdir -p ../../exe
231	$(CXX) $(CXXFLAGS) -o $@ $(OBJFILES) \
232		$(LINKFLTKGL) $(GLDLIBS)
233	$(POSTLINK) $@
234
235static: .deps $(OBJFILES)
236	echo Linking $@...
237	mkdir -p ../../exe
238	$(CXX) $(CXXFLAGS) -static -o DRAWxtl.$@ $(OBJFILES) \
239		$(LINKFLTKGL) $(GLDLIBS) -lXxf86vm -ldl
240	strip $@
241
242