-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrules.mk.in
67 lines (59 loc) · 1.81 KB
/
rules.mk.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
#
# Copyright (c) 2013 Stefan Seefeld
# All rights reserved.
#
# This file is part of OpenVSIP. It is made available under the
# license contained in the accompanying LICENSE.BSD file.
#
# Common rules used throughout the build system
vpath %.cpp $(srcdir)
vpath %.hpp $(srcdir)
# Generate dependencies (This recipe is modified from the GNU Make manual.)
# - The first sed converts .o files to .$(OBJEXT). This is a work
# around for MCOE/GreenHills which uses .o for dependencies but
# .oppc for actual files. It is a no-op if OBJEXT == .o .
define make_cvsip_dep
@echo generating dependencies for $(@D)/$(<F)
$(SHELL) -ec '$(CXXDEP) $(CPPFLAGS) -Icvsip $(CXXFLAGS) $< \
| sed "s|$(*F)\\.o[ :]*|$*\\.$(OBJEXT) : |g" \
| sed "s|$(*F)\\.$(OBJEXT)[ :]*|$*\\.d $*\\.$(OBJEXT) : |g" > $@'
endef
define make_dep
@echo generating dependencies for $(@D)/$(<F)
mkdir -p $(@D)
$(SHELL) -ec '$(CXXDEP) $(CPPFLAGS) $(CXXFLAGS) $< \
| sed "s|$(*F)\\.o[ :]*|$(*F)\\.$(OBJEXT) : |g" \
| sed "s|$(*F)\\.$(OBJEXT)[ :]*|$*\\.d $*\\.$(OBJEXT) : |g" > $@'
endef
define ccompile
@echo compiling $(@D)/$(@F)
$(CC) -c $(CFLAGS) -o $@ $<
endef
define compile
@echo compiling $(@D)/$(@F)
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
endef
define archive
@echo archiving $@
$(AR) rc $@ $^ || rm -f $@
endef
# Used for linking a shared libraries.
#
# -Llib goes before LDFLAGS. This avoids accidentally using
# previously installed version of the library.
ifneq (,$(findstring -g,$(LDFLAGS)))
define link_lib_dso
@echo linking $@
$(LDSHARED) -L../../lib $(LDFLAGS) -o $@ $^ $(LIBS) $(MPI_LIBS)
endef
else
define link_lib_dso
@echo linking $@
$(LDSHARED) -L../../lib $(LDFLAGS) -o $@ $^ $(LIBS) $(MPI_LIBS)
$(STRIP) $@
endef
endif
define link
@echo linking $@
$(CXX) $(LDFLAGS) -o $@ $< -L$(top_builddir)/lib -l$(OVXXLIB) $(LIBS)
endef