1 | # | |
---|
2 | # o---------------------------------------------------------------------o |
---|
3 | # | |
---|
4 | # | MAD makefile - depend rules |
---|
5 | # | |
---|
6 | # o---------------------------------------------------------------------o |
---|
7 | # | |
---|
8 | # | Methodical Accelerator Design |
---|
9 | # | |
---|
10 | # | Copyright (c) 2011+ CERN, mad@cern.ch |
---|
11 | # | |
---|
12 | # | For more information, see http://cern.ch/mad |
---|
13 | # | |
---|
14 | # o---------------------------------------------------------------------o |
---|
15 | # | |
---|
16 | # | $Id$ |
---|
17 | # | |
---|
18 | |
---|
19 | vpath %.d $(OBJDIR) |
---|
20 | vpath %.mod $(OBJDIR) |
---|
21 | |
---|
22 | # |
---|
23 | # rule for C dependencies |
---|
24 | # |
---|
25 | $(OBJDIR)/%.d: %.c |
---|
26 | $E "*** Computing $(@F)" |
---|
27 | $_ $(call CC_tr,$(CDEP) $(CPPFLAGS) $<) $(CDEP_tr) > $@ |
---|
28 | |
---|
29 | # |
---|
30 | # rule for C++ dependencies |
---|
31 | # |
---|
32 | $(OBJDIR)/%.d: %.cpp |
---|
33 | $E "*** Computing $(@F)" |
---|
34 | $_ $(call CXX_tr,$(CXXDEP) $(CPPFLAGS) $<) $(CXXDEP_tr) > $@ |
---|
35 | |
---|
36 | # |
---|
37 | # rule for f90 and F90 dependencies |
---|
38 | # |
---|
39 | $(OBJDIR)/%.d: %.f90 |
---|
40 | $E "*** Computing $(@F)" |
---|
41 | $_ $(call FC_tr,$(FDEP) $<) $(FDEP_tr) > $@ |
---|
42 | |
---|
43 | $(OBJDIR)/%.d: %.F90 |
---|
44 | $E "*** Computing $(@F)" |
---|
45 | $_ $(call FC_tr,$(FDEP) $(CPPFLAGS) $<) $(FDEP_tr) > $@ |
---|
46 | |
---|
47 | # |
---|
48 | # compute dependencies |
---|
49 | # |
---|
50 | C_DEPS := $(patsubst %.c,%.d,$(CC_SRC)) |
---|
51 | CXX_DEPS := $(patsubst %.cpp,%.d,$(CXX_SRC)) |
---|
52 | F_DEPS := $(patsubst %.F90,%.d,$(patsubst %.f90,%.d,$(FC_SRC))) |
---|
53 | DEPENDS := |
---|
54 | |
---|
55 | ifneq ($(CDEP),) |
---|
56 | DEPENDS += $(C_DEPS) |
---|
57 | endif |
---|
58 | |
---|
59 | ifneq ($(CXXDEP),) |
---|
60 | DEPENDS += $(CXX_DEPS) |
---|
61 | endif |
---|
62 | |
---|
63 | ifneq ($(FDEP),) |
---|
64 | DEPENDS += $(F_DEPS) |
---|
65 | endif |
---|
66 | |
---|
67 | # |
---|
68 | # include dependencies |
---|
69 | # |
---|
70 | ifneq ($(filter $(BUILDGOALS),$(MAKECMDGOALS)),) |
---|
71 | -include $(addprefix $(OBJDIR)/,$(DEPENDS)) |
---|
72 | endif |
---|
73 | |
---|
74 | # end of makefile |
---|
75 | |
---|