1#
2# Makefile for the VolPack library.  If it has the name "Makefile.in"
3# then it is a template for a Makefile; to generate the actual Makefile,
4# run "./configure", which is a configuration script generated by the
5# "autoconf" program (constructs like "@foo@" will get replaced in the
6# actual Makefile).
7#
8# Copyright (c) 1994 The Board of Trustees of The Leland Stanford
9# Junior University.  All rights reserved.
10#
11# Permission to use, copy, modify and distribute this software and its
12# documentation for any purpose is hereby granted without fee, provided
13# that the above copyright notice and this permission notice appear in
14# all copies of this software and that you do not sell the software.
15# Commercial licensing is available by contacting the author.
16#
17# THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
18# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
19# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
20#
21# Author:
22#    Phil Lacroute
23#    Computer Systems Laboratory
24#    Electrical Engineering Dept.
25#    Stanford University
26#
27
28# shell to use for executing make commands
29SHELL =		/bin/sh
30
31###########################################################################
32# Options that can be changed by the user.
33###########################################################################
34
35# default top-level directory for installing architecture-independent files
36# (include files, documentation)
37prefix = 	@prefix@
38
39# default top-level directory for installing architecture-specific files
40# (binaries)
41exec_prefix = 	@exec_prefix@
42
43# directory in which to install the VolPack library
44LIB_DIR = 	$(exec_prefix)/lib
45
46# directory for include files
47INCLUDE_DIR = 	$(prefix)/include
48
49# top-level directory for manual entries
50MAN_DIR = 	$(prefix)/man
51
52# directory in which to install manual entries for library functions
53MAN3_DIR = 	$(MAN_DIR)/man3
54
55# ANSI-C prototypes: use the first line to let the #ifdef's in
56# volpack.h guess if your compiler supports prototypes, use the
57# second line to disable prototypes, or use the third line to
58# enable prototypes
59PROTO_FLAG =
60#PROTO_FLAG =	-DNO_PROTOTYPE
61#PROTO_FLAG =	-DANSI_C
62
63# loop unrolling optimization: if the following line is not commented
64# out then the library will be built with a special version of the
65# rendering code that has been hand-optimized; use this unless your
66# compiler's optimizer has trouble with procedures that have a large
67# number of basic blocks
68#UNROLL_FLAG = -DUNROLL_RUN_LOOP
69
70# optional compiler flags:
71#    use the first line for full optimization
72#    use the second line for no optimization
73# the other lines are for various levels of debugging
74CCOPT_FLAGS = $(OFLAGS)
75#CCOPT_FLAGS =
76#CCOPT_FLAGS = -DASSERTIONS -fullwarn -g
77#CCOPT_FLAGS = -DDEBUG -DASSERTIONS -fullwarn -g
78
79# list of optional C source files to build with code specialized
80# for particular shaders and resampling filters
81OPT_SRCS =	vp_compAC11B.c vp_compAC31B.c vp_compAC32B.c \
82		vp_compAR11B.c vp_compAR31B.c vp_compAR32B.c
83
84# object files corresponding to COMP_SRCS
85OPT_OBJS =	vp_compAC11B.o vp_compAC31B.o vp_compAC32B.o \
86		vp_compAR11B.o vp_compAR31B.o vp_compAR32B.o
87
88# C define flags corresponding to COMP_SRCS; these tell the dispatch
89# routines in the library which object files are available
90OPT_FLAGS =	-DCOMP_AC11B   -DCOMP_AC31B   -DCOMP_AC32B \
91		-DCOMP_AR11B   -DCOMP_AR31B   -DCOMP_AR32B
92
93###########################################################################
94# Options that are changed by the configure script.  These should
95# probably not be editted by hand.
96###########################################################################
97
98# pathname for the C compiler
99CC = 		@CC@
100
101# pathname for the m4 macro preprocessor; it must understand the -D flag
102# (some BSD versions do not; GNU m4 works)
103M4 = 		@M4@
104
105# pathname for ranlib if you need it
106RANLIB = 	@RANLIB@
107
108# commands to use to install files
109INSTALL = 	@INSTALL@
110INSTALL_DATA =	@INSTALL_DATA@
111
112# directory containing source code
113SRC_DIR = 	@srcdir@
114VPATH = 	@srcdir@
115
116# compiler options
117AC_FLAGS = 	@DEFS@
118
119# system-dependent options based on system name passed to configure;
120# this macro is for options that should always be included (even for
121# compiles with optimization turned off); configure can fill
122# this in automatically if you supply a recognized system name
123MFLAGS =	@MFLAGS@
124
125# system-dependent options based on system name passed to configure;
126# this macro is for optimization options only; configure can fill
127# this in automatically if you supply a recognized system name
128OFLAGS =	@OFLAGS@
129
130###########################################################################
131# Nothing beyond this point should need to be changed by the user.
132###########################################################################
133
134CFLAGS = -I. -I$(SRC_DIR) $(AC_FLAGS) $(CCOPT_FLAGS) $(MFLAGS) \
135	 $(PROTO_FLAG) $(UNROLL_FLAG) $(OPT_FLAGS)
136
137CSRC = vp_check.c vp_context.c vp_extract.c vp_file.c vp_linalg.c vp_octree.c \
138       vp_renderA.c vp_renderB.c vp_renderC.c vp_renderR.c vp_resample.c \
139       vp_rle.c vp_shade.c vp_transpose.c vp_util.c vp_view.c vp_warp.c
140HSRC = volpack.h vp_global.h patchlevel.h
141MSRC = vp_compA.m4 vp_warpA.m4
142SUPPORT = Makefile.in configure.in no_edit_header makeopts.c
143COMP_SRCS = vp_compAC1NB.c vp_compAC3NB.c vp_compAR1NB.c vp_compAR3NB.c \
144       vp_compAC1PB.c vp_compAC3PB.c vp_compAR1PB.c vp_compAR3PB.c \
145       vp_compAC00G.c vp_compAR00G.c vp_compAC1NS.c vp_compAC3NS.c \
146       vp_compAR1NS.c vp_compAR3NS.c $(OPT_SRCS)
147COMP_OBJS = vp_compAC1NB.o vp_compAC3NB.o vp_compAR1NB.o vp_compAR3NB.o \
148       vp_compAC1PB.o vp_compAC3PB.o vp_compAR1PB.o vp_compAR3PB.o \
149       vp_compAC00G.o vp_compAR00G.o vp_compAC1NS.o vp_compAC3NS.o \
150       vp_compAR1NS.o vp_compAR3NS.o $(OPT_OBJS)
151WARP_SRCS = vp_warpA101N.c vp_warpA301N.c vp_warpA110N.c vp_warpA111N.c \
152       vp_warpA330N.c vp_warpA331N.c vp_warpA330R.c vp_warpA331R.c
153WARP_OBJS = vp_warpA101N.o vp_warpA301N.o vp_warpA110N.o vp_warpA111N.o \
154       vp_warpA330N.o vp_warpA331N.o vp_warpA330R.o vp_warpA331R.o
155CGEN = vp_opts.c $(COMP_SRCS) $(WARP_SRCS)
156OBJS = vp_check.o vp_context.o vp_extract.o vp_file.o vp_linalg.o vp_octree.o \
157       vp_renderA.o vp_renderB.o vp_renderC.o vp_renderR.o vp_resample.o \
158       vp_rle.o vp_shade.o vp_transpose.o vp_util.o vp_view.o vp_warp.o \
159       vp_opts.o $(COMP_OBJS) $(WARP_OBJS)
160COMP_IN = $(SRC_DIR)/no_edit_header $(SRC_DIR)/vp_compA.m4
161WARP_IN = $(SRC_DIR)/no_edit_header $(SRC_DIR)/vp_warpA.m4
162ESRC = vp_raycast.c
163EOBJ = vp_raycast.o
164
165all: libvolpack.a
166
167libvolpack.a: $(OBJS)
168	rm -f libvolpack.a
169	ar cr libvolpack.a $(OBJS)
170	$(RANLIB) libvolpack.a
171
172$(OBJS): volpack.h vp_global.h config.h
173
174makeopts: makeopts.c
175	cc -o makeopts makeopts.c
176
177vp_opts.c: makeopts Makefile
178	./makeopts vp_opts.c $(CFLAGS)
179
180$(COMP_SRCS): $(COMP_IN)
181	$(M4) -DSourceFile=$@ $(COMP_IN) > $@ && chmod -w $@
182
183$(WARP_SRCS): $(WARP_IN)
184	$(M4) -DSourceFile=$@ $(WARP_IN) > $@ && chmod -w $@
185
186examples: libvolpack.a
187	cd examples; make
188
189install: install-binaries install-include install-man
190
191install-binaries: libvolpack.a
192	@for i in $(DESTDIR)$(LIB_DIR) ; \
193	    do \
194	    if [ ! -d $$i ] ; then \
195		echo "Making directory $$i"; \
196		mkdir $$i ; \
197		chmod 755 $$i; \
198		else true; \
199		fi; \
200	    done;
201	@echo "Installing libvolpack.a"
202	@$(INSTALL_DATA) libvolpack.a $(DESTDIR)$(LIB_DIR)
203	@$(RANLIB) $(DESTDIR)$(LIB_DIR)/libvolpack.a
204
205install-include:
206	@for i in $(DESTDIR)$(INCLUDE_DIR) ; \
207	    do \
208	    if [ ! -d $$i ] ; then \
209		echo "Making directory $$i"; \
210		mkdir $$i ; \
211		chmod 755 $$i; \
212		else true; \
213		fi; \
214	    done;
215	@echo "Installing volpack.h"
216	@$(INSTALL_DATA) volpack.h $(DESTDIR)$(INCLUDE_DIR)
217
218install-man:
219	@for i in $(DESTDIR)$(MAN_DIR) $(DESTDIR)$(MAN3_DIR) ; \
220	    do \
221	    if [ ! -d $$i ] ; then \
222		echo "Making directory $$i"; \
223		mkdir $$i ; \
224		chmod 755 $$i; \
225		else true; \
226		fi; \
227	    done;
228	@cd $(SRC_DIR)/man/src; for i in *.3; \
229	    do \
230	    echo "Installing man/src/volpack-$$i"; \
231	    cp $$i $(DESTDIR)$(MAN3_DIR)/volpack-$$i; \
232	    chmod 444 $(DESTDIR)$(MAN3_DIR)/volpack-$$i; \
233	    done;
234
235Makefile: $(SRC_DIR)/Makefile.in
236	./config.status
237
238mostlyclean:
239	rm -f $(OBJS) $(CGEN) makeopts
240
241clean: mostlyclean
242	rm -f libvolpack.a
243
244distclean: clean
245	rm -f config.status config.log config.cache config.h Makefile
246
247checkin:
248	ci -l -f $(CSRC) $(HSRC) $(MSRC) $(ESRC) $(SUPPORT)
249