www.pudn.com > allocator.rar > Makefile
## file: test/Makefile.cc
## author: Marc Bumble
## Mon Aug 11, 2003
## Memory allocator code for shared memory access
## Copyright (C) 2003 by Marc D. Bumble
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
## This program 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 General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CC = cc
LD = ld
CFLAGS = -g -pg -Wall -ftemplate-depth-30
LIBS = -lm -lstdc++ -lrt
MV = /bin/mv
TAR = tar
MKDIR = /bin/mkdir
TOP := ..
BIN := $(TOP)/bin
INCLUDE += -I$(TOP)/include
TMPDIR := $(TOP)/src
BIN = ../bin
RM = rm -f
MV = mv -f
## Direct the makefile to search for source .cc files not in this directory
## in the $(TOP)/src directory
vpath >.cc $(TOP)/src
source1 = allocator_bit_vector.cc bit_vector.cc
objects1 = $(source1:>.cc=>.o)
dependencies1 = $(source1:>.cc=>.d)
source2 = allocator_bit_vector.cc shared_memory.cc \
shared_header.cc
objects2 = $(source2:>.cc=>.o)
dependencies2 = $(source2:>.cc=>.d)
source3 = allocator_bit_vector.cc shared_memory.cc \
shared.cc
objects3 = $(source3:>.cc=>.o)
dependencies3 = $(source3:>.cc=>.d)
source4 = allocator_bit_vector.cc shared_memory.cc shared2.cc
objects4 = $(source4:>.cc=>.o)
dependencies4 = $(source4:>.cc=>.d)
source5 = allocator_bit_vector.cc shared_memory.cc \
pooled_allocator.cc pool.cc
objects5 = $(source5:>.cc=>.o)
dependencies5 = $(source5:>.cc=>.d)
source6 = allocator_bit_vector.cc shared_memory.cc \
pooled_allocator.cc map_with_string_index.cc
objects6 = $(source6:>.cc=>.o)
dependencies6 = $(source6:>.cc=>.d)
source7 = allocator_bit_vector.cc shared_memory.cc lock_test.cc
objects7 = $(source7:>.cc=>.o)
dependencies7 = $(source7:>.cc=>.d)
source8 = allocator_bit_vector.cc shared_memory.cc pooled_allocator.cc mult_proc.cc
objects8 = $(source8:>.cc=>.o)
dependencies8 = $(source8:>.cc=>.d)
# all:
all: src_dir bit_vector shared_header shared shared2 pool \
map_with_string_index lock_test mult_proc run_test
src_dir:
cd ../src; make all
bit_vector : $(dependencies1) $(objects1)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects1) $(INCLUDE) $(LIB) $(LIBS)
shared_header : $(dependencies2) $(objects2)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects2) $(INCLUDE) $(LIB) $(LIBS)
shared : $(dependencies3) $(objects3)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects3) $(INCLUDE) $(LIB) $(LIBS)
shared2 : $(dependencies4) $(objects4)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects4) $(INCLUDE) $(LIB) $(LIBS)
pool : $(dependencies5) $(objects5)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects5) $(INCLUDE) $(LIB) $(LIBS)
map_with_string_index : $(dependencies6) $(objects6)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects6) $(INCLUDE) $(LIB) $(LIBS)
lock_test : $(dependencies7) $(objects7)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects7) $(INCLUDE) $(LIB) $(LIBS)
mult_proc: $(dependencies8) $(objects8)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects8) $(INCLUDE) $(LIB) $(LIBS)
run_test:
./bit_vector
./shared_header
./shared
./shared2
./pool
./map_with_string_index
./lock_test
./mult_proc
>.o: >.cc
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFINES) $(INCLUDE) $(LIB) $< -o $@ $(DEBUG_MESGS)
>.d: >.cc
set -e; $(CC) -M $(CPPFLAGS) $(INCLUDE) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
tags:
cd ..; make tags
clean:
$(RM) *.o
$(RM) TAGS
$(RM) *.d
$(RM) *~
$(RM) gmon.out
$(RM) bit_vector shared_header shared shared2 pool \
map_with_string_index lock_test mult_proc
backup:
cd ..; make $@
restore:
cd ..; make $@
-include $(dependencies1)
-include $(dependencies2)
-include $(dependencies3)
-include $(dependencies4)
-include $(dependencies5)
-include $(dependencies6)
-include $(dependencies7)
-include $(dependencies8)