-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile.in
79 lines (67 loc) · 2.28 KB
/
Makefile.in
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Set these values for your system
CC = @CONFIG_CC@
MPICC = @CONFIG_MPICC@
CFLAGS = @CONFIG_CFLAGS@ @CL_CFLAGS@ @OPENACC_CFLAGS@
LDFLAGS = @CONFIG_LDFLAGS@
LIBS = @CONFIG_LIBS@ @CL_LIBS@
DEPC = @DEPC_PATH@
CPPFLAGS = @CPPFLAGS@
# Paths to the include, source, plan, and build directories...
ABSOLUTE_PATH = @CONFIG_PROJECT_DIR@
SRC_DIR = src
PLAN_DIR = planlib
BUILD_DIR = build
#PAPI_DIR = papi
#PAPI_LIB = $(PAPI_DIR)/libpapi.a
# Set VPATH to search these directories for .c files
VPATH = $(SRC_DIR):$(PLAN_DIR)
# whether or not to compile DGEMM or FFTW modules
ENABLE_BLAS = @ENABLE_BLAS@
ENABLE_FFTW = @ENABLE_FFTW@
ENABLE_CUDA = @ENABLE_CUDA@
ENABLE_PAPI = @ENABLE_PAPI@
ENABLE_OPENCL = @ENABLE_OPENCL@
ENABLE_OPENACC = @ENABLE_OPENACC@
# Search paths for the header files
#INCLUDES = -I$(SRC_DIR) -I$(PLAN_DIR) -I.
INCLUDES = -I$(SRC_DIR) -I$(PLAN_DIR) -I.
# Include makefile modules
include $(SRC_DIR)/module.mk
include $(PLAN_DIR)/module.mk
ALL_SRC := $(SRC_SRC) $(PLAN_SRC)
# objects to build
SRC_OBJS := $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(filter %.c, $(SRC_SRC)))
PLAN_OBJS := $(patsubst $(PLAN_DIR)/%.c, $(BUILD_DIR)/%.o, $(filter %.c, $(PLAN_SRC)))
ALL_OBJS := $(SRC_OBJS) $(PLAN_OBJS)
# code dependencies to generate
SRC_DEPS := $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.d, $(filter %.c, $(SRC_SRC)))
PLAN_DEPS := $(patsubst $(PLAN_DIR)/%.c, $(BUILD_DIR)/%.d, $(filter %.c, $(PLAN_SRC)))
ALL_DEPS := $(SRC_DEPS) $(PLAN_DEPS)
MAKEDEP := $(DEPC) -MM
# Build rules
.DEFAULT: all
all: systemburn
systemburn: build_dir $(ALL_OBJS)
$(MPICC) $(CFLAGS) $(INCLUDES) $(LDFLAGS) -o systemburn $(ALL_OBJS) $(LIBS) $(PAPI_LIB)
build_dir:
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.o: %.c
$(MPICC) $(CFLAGS) $(INCLUDES) $(CPPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.d: %.c
@echo "Generating dependencies for $< (output in $@)"
@mkdir -p $(BUILD_DIR)
@# call 'gcc -MM %.c', then add the build dir and %.d to the left side of the colon
@$(MAKEDEP) $(INCLUDES) $< | sed 's@^\(.*\)\.o:@$(BUILD_DIR)/\1.d $(BUILD_DIR)/\1.o:@g' > $@
# Include dependencies for build commands
ifeq ($(strip $(filter %clean %clobber, $(MAKECMDGOALS)) ),)
-include $(ALL_DEPS)
endif
# Other options
depclean:
rm -f build/*.d
clean: depclean
rm -f build/*.o
rm -f systemburn
clobber: clean
rm -f systemburn
rmdir $(BUILD_DIR)