-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (37 loc) · 1.07 KB
/
Makefile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Compiler and hypre location
CC = h5pcc
ifndef HYPRE_DIR
$(info HYPRE_DIR not defined, trying '/usr/local/hypre')
HYPRE_DIR = /usr/local/hypre
endif
# Local directories
INC_DIR = $(CURDIR)/include
SRC_DIR = $(CURDIR)/src
OBJ_DIR = $(CURDIR)/obj
# Compiling and linking options
COPTS = -g -Wall
CINCLUDES = -I$(HYPRE_DIR)/include -I$(INC_DIR)
CDEFS = -DHAVE_CONFIG_H -DHYPRE_TIMING
CFLAGS = $(COPTS) $(CINCLUDES) $(CDEFS)
LINKOPTS = $(COPTS)
LDFLAGS = -L$(HYPRE_DIR)/lib
LIBS = -lHYPRE -lm -lgsl -lgslcblas -shlib -lstdc++
LFLAGS = $(LINKOPTS) $(LIBS)
# List of all programs to be compiled
EXE = poisson general_xy
# disk_logr disk_xy noisy_unif noisy_disk are deprecated, located in src/old_models/
SRC := $(addprefix $(SRC_DIR)/,main.c hdf5_utils.c model_%.c param_%.c)
OBJ := $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
all: $(EXE)
$(EXE): %: $(OBJ)
$(CC) $(LDFLAGS) $^ $(LFLAGS) -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJ_DIR):
mkdir $@
default: all
# Clean up
clean:
$(RM) -r $(OBJ_DIR)
distclean: clean
$(RM) $(EXE)