1# makefile for Triangle and Show Me
2#
3# Type "make" to compile Triangle and Show Me.
4#
5# After compiling, type "triangle -h" and "showme -h" to read instructions
6#   for using each of these programs.
7#
8# Type "make trilibrary" to compile Triangle as an object file (triangle.o).
9#
10# Type "make distclean" to delete all object and executable files.
11
12# SRC is the directory in which the C source files are, and BIN is the
13#   directory where you want to put the executable programs.  By default,
14#   both are the current directory.
15
16SRC = ./
17BIN = ./
18
19# CC should be set to the name of your favorite C compiler.
20
21CC = cc
22
23# CSWITCHES is a list of all switches passed to the C compiler.  I strongly
24#   recommend using the best level of optimization.  I also strongly
25#   recommend timing each level of optimization to see which is the
26#   best.  For instance, when I had a DEC Alpha using DEC's optimizing
27#   compiler, the -O2 switch generated a notably faster version of Triangle
28#   than the -O3 switch.  Go figure.
29#
30# By default, Triangle and Show Me use double precision floating point
31#   numbers.  If you prefer single precision, use the -DSINGLE switch.
32#   Double precision uses more memory, but improves the resolution of
33#   the meshes you can generate with Triangle.  It also reduces the
34#   likelihood of a floating exception due to overflow.  Also, it is
35#   much faster than single precision on many architectures.  I recommend
36#   double precision unless you want to generate a mesh for which you do
37#   not have enough memory to use double precision.
38#
39# If yours is not a Unix system, use the -DNO_TIMER switch to eliminate the
40#   Unix-specific timer code.  Also, don't try to compile Show Me; it only
41#   works with X Windows.
42#
43# To get the exact arithmetic to work right on an Intel processor, use the
44#   -DCPU86 switch with Microsoft C, or the -DLINUX switch with gcc running
45#   on Linux.  The floating-point arithmetic might not be robust otherwise.
46#   Please see http://www.cs.cmu.edu/~quake/robust.pc.html for details.
47#
48# If you are modifying Triangle, I recommend using the -DSELF_CHECK switch
49#   while you are debugging.  Defining the SELF_CHECK symbol causes
50#   Triangle to include self-checking code.  Triangle will execute more
51#   slowly, however, so be sure to remove this switch before compiling a
52#   production version.
53#
54# If the size of the Triangle binary is important to you, you may wish to
55#   generate a reduced version of Triangle.  The -DREDUCED switch gets rid
56#   of all features that are primarily of research interest.  Specifically,
57#   defining the REDUCED symbol eliminates the -i, -F, -s, and -C switches.
58#   The -DCDT_ONLY switch gets rid of all meshing algorithms above and beyond
59#   constrained Delaunay triangulation.  Specifically, defining the CDT_ONLY
60#   symbol eliminates the -r, -q, -a, -u, -D, -S, and -s switches.  The
61#   REDUCED and CDT_ONLY symbols may be particularly attractive when Triangle
62#   is called by another program that does not need all of Triangle's
63#   features; in this case, these switches should appear as part of
64#   "TRILIBDEFS" below.
65#
66# On some systems, you may need to include -I/usr/local/include and/or
67#   -L/usr/local/lib in the compiler options to ensure that the X include
68#   files and libraries that Show Me needs are found.  If you get errors
69#   like "Can't find include file X11/Xlib.h", you need the former switch.
70#   Try compiling without them first; add them if that fails.
71#
72# An example CSWITCHES line is:
73#
74#   CSWITCHES = -O -DNO_TIMER -DLINUX -I/usr/X11R6/include -L/usr/X11R6/lib
75
76CSWITCHES = -O -DLINUX -I/usr/X11R6/include -L/usr/X11R6/lib
77
78# TRILIBDEFS is a list of definitions used to compile an object code version
79#   of Triangle (triangle.o) to be called by another program.  The file
80#   "triangle.h" contains detailed information on how to call triangle.o.
81#
82# The -DTRILIBRARY should always be used when compiling Triangle into an
83#   object file.
84#
85# An example TRILIBDEFS line is:
86#
87#   TRILIBDEFS = -DTRILIBRARY -DREDUCED -DCDT_ONLY
88
89TRILIBDEFS = -DTRILIBRARY
90
91# RM should be set to the name of your favorite rm (file deletion program).
92
93RM = /bin/rm
94
95# The action starts here.
96
97all: $(BIN)triangle $(BIN)showme
98
99trilibrary: $(BIN)triangle.o $(BIN)tricall
100
101$(BIN)triangle: $(SRC)triangle.c
102	$(CC) $(CSWITCHES) -o $(BIN)triangle $(SRC)triangle.c -lm
103
104$(BIN)tricall: $(BIN)tricall.c $(BIN)triangle.o
105	$(CC) $(CSWITCHES) -o $(BIN)tricall $(SRC)tricall.c \
106		$(BIN)triangle.o -lm
107
108$(BIN)triangle.o: $(SRC)triangle.c $(SRC)triangle.h
109	$(CC) $(CSWITCHES) $(TRILIBDEFS) -c -o $(BIN)triangle.o \
110		$(SRC)triangle.c
111
112$(BIN)showme: $(SRC)showme.c
113	$(CC) $(CSWITCHES) -o $(BIN)showme $(SRC)showme.c -lX11
114
115distclean:
116	$(RM) $(BIN)triangle $(BIN)triangle.o $(BIN)tricall $(BIN)showme
117