bgfx/3rdparty/openctm/tools/Makefile.linux
2012-10-07 20:41:18 -07:00

112 lines
4.5 KiB
Text

###############################################################################
# Product: OpenCTM tools
# File: Makefile.linux
# Description: Makefile for the OpenCTM tools, Linux version
###############################################################################
# Copyright (c) 2009-2010 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not
# be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
###############################################################################
OPENCTMDIR = ../lib
GLEWDIR = glew
JPEGDIR = jpeg
RPLYDIR = rply
TINYXMLDIR = tinyxml
ZLIBDIR = zlib
PNGLITEDIR = pnglite
CPP = g++
CPPFLAGS = -c -O3 -W -Wall `pkg-config --cflags gtk+-2.0` -I$(OPENCTMDIR) -I$(RPLYDIR) -I$(JPEGDIR) -I$(TINYXMLDIR) -I$(GLEWDIR) -I$(ZLIBDIR) -I$(PNGLITEDIR)
MESHOBJS = mesh.o meshio.o ctm.o ply.o rply.o stl.o 3ds.o dae.o obj.o lwo.o off.o wrl.o
CTMCONVOBJS = ctmconv.o common.o systimer.o convoptions.o $(MESHOBJS)
CTMVIEWEROBJS = ctmviewer.o common.o image.o systimer.o sysdialog_gtk.o convoptions.o glew.o pnglite.o $(MESHOBJS)
CTMBENCHOBJS = ctmbench.o systimer.o
all: ctmconv ctmviewer ctmbench
clean:
rm -f ctmconv ctmviewer ctmbench $(CTMCONVOBJS) $(CTMVIEWEROBJS) $(CTMBENCHOBJS) bin2c phong_frag.h phong_vert.h
cd $(JPEGDIR) && $(MAKE) -f makefile.linux clean
cd $(TINYXMLDIR) && $(MAKE) -f Makefile.linux clean
cd $(ZLIBDIR) && $(MAKE) -f Makefile.linux clean
libopenctm.so: $(OPENCTMDIR)/libopenctm.so
cp $< $@
ctmconv: $(CTMCONVOBJS) $(TINYXMLDIR)/libtinyxml.a libopenctm.so
$(CPP) -s -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) $(CTMCONVOBJS) -Wl,-rpath,. -lopenctm -ltinyxml
ctmviewer: $(CTMVIEWEROBJS) $(JPEGDIR)/libjpeg.a $(TINYXMLDIR)/libtinyxml.a $(ZLIBDIR)/libz.a libopenctm.so
$(CPP) -s -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) -L$(JPEGDIR) -L$(ZLIBDIR) $(CTMVIEWEROBJS) -Wl,-rpath,. -lopenctm -ltinyxml -ljpeg -lz -lglut -lGL -lGLU `pkg-config --libs gtk+-2.0`
ctmbench: $(CTMBENCHOBJS) libopenctm.so
$(CPP) -s -o $@ -L$(OPENCTMDIR) $(CTMBENCHOBJS) -Wl,-rpath,. -lopenctm
%.o: %.cpp
$(CPP) $(CPPFLAGS) -o $@ $<
ctmconv.o: ctmconv.cpp systimer.h convoptions.h mesh.h meshio.h
ctmviewer.o: ctmviewer.cpp common.h image.h systimer.h sysdialog.h mesh.h meshio.h phong_vert.h phong_frag.h icons/icon_open.h icons/icon_save.h icons/icon_help.h
ctmbench.o: ctmbench.cpp systimer.h
common.o: common.cpp common.h
image.o: image.cpp image.h common.h $(JPEGDIR)/libjpeg.a
systimer.o: systimer.cpp systimer.h
sysdialog_gtk.o: sysdialog_gtk.cpp sysdialog.h
convoptions.o: convoptions.cpp convoptions.h
mesh.o: mesh.cpp mesh.h convoptions.h
meshio.o: meshio.cpp common.h convoptions.h mesh.h ctm.h ply.h stl.h 3ds.h dae.h obj.h lwo.h off.h wrl.h
ctm.o: ctm.cpp ctm.h mesh.h convoptions.h
ply.o: ply.cpp ply.h mesh.h convoptions.h common.h
stl.o: stl.cpp stl.h mesh.h convoptions.h
3ds.o: 3ds.cpp 3ds.h mesh.h convoptions.h
dae.o: dae.cpp dae.h mesh.h convoptions.h
obj.o: obj.cpp obj.h mesh.h convoptions.h common.h
lwo.o: lwo.cpp lwo.h mesh.h convoptions.h
off.o: off.cpp off.h mesh.h convoptions.h common.h
wrl.o: wrl.cpp wrl.h mesh.h convoptions.h common.h
phong_vert.h: phong.vert bin2c
./bin2c phong.vert phongVertSrc > $@
phong_frag.h: phong.frag bin2c
./bin2c phong.frag phongFragSrc > $@
bin2c: bin2c.cpp
$(CPP) -Os -W -Wall -o $@ $<
$(JPEGDIR)/libjpeg.a:
cd $(JPEGDIR) && $(MAKE) -f makefile.linux libjpeg.a
$(ZLIBDIR)/libz.a:
cd $(ZLIBDIR) && $(MAKE) -f Makefile.linux
glew.o: $(GLEWDIR)/glew.c
gcc -c -Os -W -I$(GLEWDIR) -o $@ $<
rply.o: $(RPLYDIR)/rply.c
gcc -c -O2 -W -I$(RPLYDIR) -o $@ $<
pnglite.o: $(PNGLITEDIR)/pnglite.c
gcc -c -O2 -W -I$(PNGLITEDIR) -o $@ $<
$(TINYXMLDIR)/libtinyxml.a:
cd $(TINYXMLDIR) && $(MAKE) -f Makefile.linux