-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.mk
109 lines (90 loc) · 2.25 KB
/
module.mk
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#
# Copyright (c) 2010-2014 Astrid Nikodem, Alexei Matveev
#
# Make has no scopes, not to pollute the namespace
# use $(DLB)/..., or DLB- prefix for targets and $(DLB-...)
# prefix for variables. A notable exception so far is the
# top-level traget
#
# $(libdlb.a)
#
#
# We expect the before "include"ing this file the
# variable $(DLB) is set to a suitable prefix.
#
# CURDIR is set on every make or $(MAKE) -C dir:
#
DLB ?= $(CURDIR)
#
# DLB library, used for tests and in PG,
# this may be used to refer to the targets from outside:
#
libdlb.a = $(DLB)/libdlb.a
#
# This value specifes the amount of output (of DLB).
# See output level in README for description.
# (0 means no output)
#
DLB_OUTPUT_LEVEL ?= 0
#
# Depending on the implementaiton set $(DLB-fobjs) and $(DLB-cobjs),
# default variant DLB_VARIANT = 0 should work in any case:
#
DLB_VARIANT ?= 0
#
# Fortran objects:
#
DLB-fobjs = $(DLB)/dlb.o $(DLB)/dlb_common.o
#
# C objects:
#
DLB-cobjs =
ifeq ($(DLB_VARIANT), 0)
DLB-fobjs += $(DLB)/dlb_impl_static.o
endif
ifeq ($(DLB_VARIANT), 1)
DLB-fobjs += $(DLB)/dlb_impl_rma.o
endif
ifeq ($(DLB_VARIANT), 2)
DLB-fobjs += $(DLB)/dlb_impl_thread_single.o $(DLB)/dlb_impl_thread_common.o
DLB-cobjs = $(DLB)/thread_wrapper.o
endif
ifeq ($(DLB_VARIANT), 3)
DLB-fobjs += $(DLB)/dlb_impl_thread_multiple.o $(DLB)/dlb_impl_thread_common.o
DLB-cobjs = $(DLB)/thread_wrapper.o
endif
DLB-fobjs += $(DLB)/dlb_assert_failed.o $(DLB)/dlb_mpi.o
#
# This is the DLB library:
#
$(libdlb.a): $(DLB-fobjs) $(DLB-cobjs)
$(AR) ruv $@ $(^)
$(RANLIB) $@
DLB-clean:
rm -f $(libdlb.a)
.PHONY: DLB-clean
#
# Below we modify "global" variables, prerequisites of
# top-level targets and set target specific compilation
# flags ...
#
#
# These (global) variables (f90objs, cobjs) are used in Make.rules to build and
# include dependencies:
#
f90objs += $(DLB-fobjs)
cobjs += $(DLB-cobjs)
#
# For historical reasons DLB files are compiled/preprocessed
# with different flags:
#
#
# Set _XOPEN_SOURCE=500 to make rwlocks available
#
$(DLB-cobjs): CFLAGS = -Wall -g -O1 -std=c99 -D_XOPEN_SOURCE=500
$(DLB-fobjs) $(DLB-fobjs:.o=.F90): FPPOPTIONS += -DFPP_OUTPUT_BORDER=$(DLB_OUTPUT_LEVEL)
#
# This is also a top-level (global) target, extend the list
# of dependencies:
#
clean: DLB-clean