summaryrefslogtreecommitdiff
path: root/src/util/Makefile.standalone
blob: 06d534f7cac9e14e22c0c65c31d4fa33d53174f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Makefile for test drivers in this directory
# $Header$

#
# We want to compile standalone test drivers which may use other flesh
# routines (eg Util_*()), so we have to link with -lCactus.  That means
# we also need to link against a bunch of other libraries which -lCactus
# uses.  The current "solution" is to find a configuration (just the first
# one in the configs directory) and grab the libraries it specifies.
# This is a kludge, but it seems to work fairly well...
#

# defaults -- override from command line as desired
CC := gcc
CFLAGS := -Wall -W -Wno-unused -Wshadow -Winline -Wpointer-arith \
          -Wbad-function-cast -Wcast-align -Wcast-qual \
          -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
EXTRA_CFLAGS :=

CONFIG_DATA_DIR := $(firstword $(wildcard ../../configs/*/config-data))
LIB_DIR         := $(dir $(CONFIG_DATA_DIR))lib

MPI_LIB_DIRS    := $(shell egrep '^MPI_LIB_DIRS' $(CONFIG_DATA_DIR)/make.extra.defn | sed -e 's/.*=//')
MPI_LIBS        := $(shell egrep '^MPI_LIBS'     $(CONFIG_DATA_DIR)/make.extra.defn | sed -e 's/.*=//')

# build outside cactus
.PHONY	: test-table-standalone
test-table-standalone	:
	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -g \
              -I. -I../include -I$(CONFIG_DATA_DIR) -L$(LIB_DIR) \
              -DUTIL_TABLE_TEST \
              -o test_Table \
              Table.c \
              $(LIB_DIR)/../datestamp.o -lCactus -lCactusBindings \
              $(addprefix -L, $(MPI_LIB_DIRS)) $(addprefix -l, $(MPI_LIBS)) \
              -lm