GNUMakefile 4.1 KB
Newer Older
Russ Fish's avatar
Russ Fish committed
1 2
#
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Russ Fish's avatar
Russ Fish committed
22 23
#

24
# Makefile for the hyperviewer application directory.  See ROADMAP for details.
25
# gmake -f GNUMakefile
26 27 28 29 30 31

# Tamara Munzner's Stanford HyperViewer code is in a subdirectory under here.
HVROOT = hypviewer
HVINC  = ${HVROOT}/include
HVSRC  = ${HVROOT}/src

Russ Fish's avatar
Russ Fish committed
32
# The following matches Munzner's Makefile scheme.
33 34
CPU = free
##CPU = linux
Russ Fish's avatar
Russ Fish committed
35
WINSYS = wxpy
36 37 38 39 40 41 42 43
##WINSYS = xt
ARCH = ${CPU}${WINSYS}

LIBRARY = hypviewer
HVLIBDIR  = ${HVSRC}/${ARCH}
HVLIBNAME = ${LIBRARY}${ARCH}
HVLIB = ${HVLIBDIR}/lib${HVLIBNAME}.a

Russ Fish's avatar
Russ Fish committed
44 45 46 47 48 49 50 51 52
# From wxgtk2-2.4-config --cxxflags
WXCFLAGS = -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
XI = /usr/X11R6/include
WXIFLAGS = -I${XI}/wx/gtk2-2.4 -I${XI}
# From wxgtk2-2.4-config --libs --gl-libs
WXLIBS = -lwx_gtk2-2.4 -lwx_gtk2_gl-2.4

CFLAGS  = -DHYPGLUT -DHYPFREE -DGL_GLEXT_LEGACY -g -DNAMESPACEHACK= ${WXCFLAGS}
INCDIRS = -I${HVINC} ${WXIFLAGS} -I/usr/local/include/python2.3
53
###STATIC =  -static
Russ Fish's avatar
Russ Fish committed
54
LDLIBS  = ${HVLIB} ${STATIC} -L/usr/X11R6/lib ${WXLIBS} -lGLU -lGL -lXmu -lXext -lX11 -lm
55

56
# Distribute the Python scripts, sources, shared library, sample input files, and user doc.
57 58
PYFILES = hypview.py exptToHv.py sshxmlrpc.py emulabclient.py hvFrameUI.py hv.py win32/hv.py
SRCFILES = README ROADMAP GNUMakefile hvgui.wxg hvmain.cpp hv.i hv.mod _hv.cpp win32/_hv.cpp
59
HVSWIG = hv.py win32/hv.py _hv.cpp win32/_hv.cpp
60
BINFILES = _hv.so 
61
DATAFILES = BigLan.hyp ts600.hyp 1088.hyp 1088-interior.hyp 2440.hyp 2440-interior.hyp
62
SCRIPTFILES = hypview pangorc.local pango.modules.local
63 64 65
DOCDIR = www
DISTFILES = ${SCRIPTFILES} ${PYFILES} ${SRCFILES} ${BINFILES} ${DATAFILES} ${DOCDIR} ${HVROOT}
DISTARCH = FreeBSD
66 67 68 69 70 71 72 73 74 75 76 77 78

# Finally, make something.
default: _hv.so

# The input for SWIG is in a .i file.  Add stuff to the interface class .h file.
# How come %apply doesn't work for std::string in hv.mod?  Workaround with sed instead.
hv.i: hv.mod ${HVINC}/HypView.h
	sed -e 's/const string & [a-z][a-z]*/const std::string \& INPUT/g' \
	    ${HVINC}/HypView.h | cat hv.mod - > hv.i

# Create the wrappers using SWIG.
hvmain.o: hvmain.cpp
	g++ -fpic -c ${CFLAGS} ${INCDIRS} hvmain.cpp
79 80 81 82 83 84
_hv.cpp hv.py win32/_hv.cpp win32/hv.py: hv.i
	# Maintain the WIN32 version of the SWIG generated files in parallel.
	swig -c++ -python -DWIN32 -module hv -o win32/_hv.cpp hv.i
	# The .py file is named by the -module argument, move it after generation.
	mv hv.py win32
	# Now the non-WIN32 version.
85 86 87
	swig -c++ -python -DHYPGLUT -DHYPFREE -module hv -o _hv.cpp hv.i

# Put the wrappers in a shared library for import by hv.py .
88
_hv.o: ${HVSWIG}
89 90
	g++ -fpic -c ${CFLAGS} ${INCDIRS} _hv.cpp
_hv.so: hvmain.o _hv.o ${HVLIB}
91
	gcc -g -shared hvmain.o _hv.o ${LDLIBS} -o _hv.so
92 93

hvlib: ${HVLIB}
Russ Fish's avatar
Russ Fish committed
94 95 96 97 98 99 100
${HVLIB}: checkhv
	@echo Making ${HVLIB}
	cd ${HVROOT}; make HVROOT=../$(HVROOT)
checkhv:
	@echo ""
	@echo Make sure that the absolute path to the hypviewer subdir is in Makefile.main .
	grep '^ROOTDIR' ${HVROOT}/Makefile.main
101 102 103 104 105 106 107 108
	@echo ""
	@echo Make sure that Makefile.${ARCH} is included, and not commented-out.
	grep Makefile.${ARCH} ${HVROOT}/Makefile.main
	@echo ""

dist:
	# Wrap a top-level hyperviewer directory around the dist files in the tarball.
	mkdir -p temp/hyperviewer
109
	cp -rp ${DISTFILES} temp/hyperviewer
110 111
	ln -s ${DOCDIR}/index.html temp/hyperviewer
	tar cfz hyperviewer-${DISTARCH}.tgz -C temp hyperviewer
112
	rm -rf temp
113 114 115

clean:
	rm *.o *.so
Russ Fish's avatar
Russ Fish committed
116
	cd ${HVROOT}; make HVROOT=$(HVROOT) clean