-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmake.rules.in
213 lines (175 loc) · 5.07 KB
/
make.rules.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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#
# Rules.mk
# written by Jonas Juselius <[email protected]> Tue Dec 4 11:41:04 EET 2001
#
.PHONY: all
all:
# how to get C objects:
c_objs:=$(addprefix $(ARCH)/,$(patsubst %.c,%.o,$(wildcard *.c)))
# mod_objs, hlo_objs, llo_objs spc_objs are user defined
# special objects treated differently in local Makefile
spc_objs:=$(addprefix $(ARCH)/,$(spc_obj_list))
# FORTRAN modules
mod_objs:=$(addprefix $(ARCH)/,$(mod_obj_list))
# high level optimization objects
hlo_objs:=$(addprefix $(ARCH)/,$(hlo_obj_list))
# low level optimization objects
llo_objs:=$(addprefix $(ARCH)/,$(llo_obj_list))
# generical FORTRAN objects
objs:=$(addprefix $(ARCH)/,$(filter-out $(spc_obj_list) $(mod_obj_list) $(hlo_obj_list) $(llo_obj_list),$(patsubst %.f,%.o,$(wildcard *.f))))
Fobjs:=$(addprefix $(ARCH)/,$(patsubst %.F,%.o,$(wildcard *.F)))
all_objs:=$(c_objs) $(mod_objs) $(spc_objs) $(hlo_objs) $(llo_objs) $(objs) $(Fobjs)
$(libdir)/$(this_lib): $(all_objs)
$(AR) rv $@ $(all_objs)
$(RAN) $@
ifeq (, $(wildcard $(ARCH)))
$(shell mkdir $(ARCH))
endif
.PHONY: dep deps
dep deps:
$(topdir)/config/mkdep90.py $(src) >deps.mk
ifeq (, $(wildcard $(srcdir)/deps.mk))
$(shell $(topdir)/config/mkdep90.py $(src) >deps.mk)
endif
include deps.mk
# TAGS and tags are for people working with vi(m) or emacs who wants to
# use the tag feature of the editors (VERY useful...)
#.PHONY: TAGS tags
TAGS: $(tag_src)
$(ETAGS) $(tag_src)
tags: $(tag_src)
$(CTAGS) $(tag_src)
.PHONY: clean realclean distclean
clean:
-@set -e; \
echo "rm -f *.o *.pyc *.pyo"; \
rm -rf $(ARCH) *.d *.pyc *.pyo;
ifneq ($(FC_MODEXT),)
-@set -e; \
echo "rm -f *.$(FC_MODEXT)"; \
rm -f *.$(FC_MODEXT);
endif
ifneq ($(INST_PROGS),)
@set -e; for i in $(bindir); do \
echo "rm -rf $$i"; rm -rf $$i; done
endif
ifneq ($(INST_LIBS),)
@set -e; for i in $(INST_LIBS); do \
echo "rm -f $$i"; rm -f $$i; done
endif
realclean: clean
-rm -f tags TAGS y.tab.c y.tab.h lex.yy.c deps.mk;
distclean: realclean
-rm -f Makefile make.config make.rules config.h
-rm -f config.cache config.log config.status
-rm -rf autom4te.cache
.PHONY: install install_bin install_lib install_modules install_data
.PHONY: install_libexec
inst_target:=
ifneq ($(INST_LIBS),)
INST_LIBS:=$(addprefix $(libdir)/,$(INST_LIBS))
inst_targets+=install_lib
endif
ifneq ($(INST_LIBEXEC),)
INST_LIBEXEC:=$(addprefix $(libexecdir)/,$(INST_LIBEXEC))
inst_targets+=install_libexec
endif
ifneq ($(INST_PROGS),)
INST_PROGS:=$(addprefix $(bindir)/,$(INST_PROGS))
inst_targets+=install_bin
endif
ifneq ($(INST_INCLUDES),)
INST_INCLUDES:=$(addprefix "$(includedir)/",$(INST_INCLUDES))
inst_targets+=install_includes
endif
ifneq ($(INST_MODULES),)
INST_MODULES:=$(addprefix "$(includedir)/",$(INST_MODULES))
inst_targets+=install_modules
endif
ifneq ($(INST_DATA),)
INST_DATA:=$(addprefix "$(datadir)/",$(INST_DATA))
inst_targets+=install_data
endif
install: $(inst_targets)
install_bin: $(INST_PROGS) $(inst_bindir)
ifneq ($(INST_PROGS),)
@set -e; \
for i in $(INST_PROGS); do \
$(INSTALL_PROGRAM) $$i $(inst_bindir); \
echo "Installed $$i in $(inst_bindir)"; \
done
endif
install_lib: $(INST_LIBS) $(inst_libdir)
ifneq ($(INST_LIBS),)
@set -e; \
for i in $(INST_LIBS); do \
$(INSTALL_DATA) $$i $(inst_libdir); \
echo "Installed $$i in $(inst_libdir)"; \
done
endif
install_libexec: $(INST_LIBEXEC) $(inst_libexecdir)
ifneq ($(INST_LIBEXEC),)
@set -e; \
for i in $(INST_LIBEXEC); do \
$(INSTALL_DATA) $$i $(inst_libexecdir); \
echo "Installed $$i in $(inst_libexecdir)"; \
done
endif
install_data: $(INST_DATA) $(inst_datadir)
ifneq ($(INST_DATA),)
@set -e; \
for i in $(INST_DATA); do \
$(INSTALL_DATA) $$i $(inst_datadir); \
echo "Installed $$i in $(inst_datadir)"; \
done
endif
install_includes: $(INST_INCLUDES) $(inst_includedir)
ifneq ($(INST_INCLUDES),)
@set -e; \
for i in $(INST_INCLUDES); do \
$(INSTALL_DATA) $$i $(inst_includedir); \
echo "Installed $$i in $(inst_includedir)"; \
done
endif
ifeq ($(FC_MODCASE), uppercase)
modname=$(addsuffix .$(FC_MODEXT),$(shell echo $(1) |tr '[:lower:]' '[:upper:]'))
else
modname=$(addsuffix .$(FC_MODEXT),$(shell echo $(1) |tr '[:upper:]' '[:lower:]' ))
endif
ifneq ($(INST_MODULES),)
INST_MODULES:=$(call modname, $(INST_MODULES))
endif
install_modules: $(inst_includedir)
ifneq ($(INST_MODULES),)
@set -e; \
for i in $(INST_MODULES); do \
$(INSTALL_DATA) $$i $(inst_includedir); \
echo "Installed $$i in $(inst_includedir)"; \
done
endif
$(inst_bindir):
@$(mkinstalldirs) $(inst_bindir)
$(inst_libdir):
@$(mkinstalldirs) $(inst_libdir)
$(inst_datadir):
@$(mkinstalldirs) $(inst_datadir)
$(inst_includedir):
@$(mkinstalldirs) $(inst_includedir)
$(ARCH)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
$(mod_objs): $(ARCH)/%.o: %.f
$(FC) $(FCFLAGS) -c $< -o $@
$(objs): $(ARCH)/%.o: %.f
$(FC) $(FCFLAGS) -c $< -o $@
$(llo_objs): $(ARCH)/%.o: %.f
$(FC) $(LLO_FCFLAGS) -c $< -o $@
$(hlo_objs): $(ARCH)/%.o: %.f
$(FC) $(HLO_FCFLAGS) -c $< -o $@
$(ARCH)/%.o: %.F
$(FC) $(FCFLAGS) -c $< -o $@
$(ARCH)/%.o: %.f90
$(FC) $(FCFLAGS) -c $< -o $@
(%.o): %.o
$(AR) rc $@ $<
$(includedir)/%.$(FC_MODEXT): %.$(FC_MODEXT)
cp -f $< $@