generated_headers.am 2.77 KB
Newer Older
1
define extract_interface
Lorenz Huedepohl's avatar
Lorenz Huedepohl committed
2
	@echo "Extracting interface marked with '$1' from $@...";
3
	@grep -h "^ *$1" $^ | sed 's/^ *$1//;' >> $@ || { rm $@; exit 1; }
4
5
endef

6
elpa test src:
7
	@mkdir $@
8

9
test/shared: | test
10
	@mkdir $@
11

12
13
14
generated_headers =

generated_headers += config-f90.h
15
16
17
18
config-f90.h: config.h
	@echo "Generating $@...";
	@grep "^#define" $^ > $@ || { rm $@; exit 1; }

19
generated_headers += elpa/elpa_generated.h
20
elpa/elpa_generated.h: $(top_srcdir)/src/elpa_impl.F90 \
Andreas Marek's avatar
Andreas Marek committed
21
                       $(top_srcdir)/src/elpa_impl_math_template.F90 \
22
                       $(top_srcdir)/src/elpa_api.F90 | elpa
Lorenz Huedepohl's avatar
Lorenz Huedepohl committed
23
	@rm -f $@
24
	$(call extract_interface,!c>)
Andreas Marek's avatar
Andreas Marek committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	$(call extract_interface,!c_o>)
	$(call extract_interface,!c_no>)

#if OPTIONAL_C_ERROR_ARGUMENT
#
#elpa/elpa_generated.h: $(top_srcdir)/src/elpa_impl.F90 \
#                       $(top_srcdir)/src/elpa_impl_math_template.F90 \
#                       $(top_srcdir)/src/elpa_api.F90 | elpa
#	$(call extract_interface,!c_o>)
#
#else
#elpa/elpa_generated.h: $(top_srcdir)/src/elpa_impl.F90 \
#                       $(top_srcdir)/src/elpa_impl_math_template.F90 \
#                       $(top_srcdir)/src/elpa_api.F90 | elpa
#	$(call extract_interface,!c_no>)
#endif
41

42
generated_headers += elpa/elpa_generated_legacy.h
43
44
45
46
47
48
elpa/elpa_generated_legacy.h: $(top_srcdir)/src/elpa_driver/legacy_interface/elpa_driver_c_interface.F90 \
                       $(top_srcdir)/src/elpa1/legacy_interface/elpa_1stage_c_interface.F90 \
                       $(top_srcdir)/src/elpa2/legacy_interface/elpa_2stage_c_interface.F90 | elpa
	@rm -f $@
	$(call extract_interface,!lc>)

49
50

generated_headers += test/shared/generated.h
Andreas Marek's avatar
Andreas Marek committed
51
test/shared/generated.h: $(wildcard $(top_srcdir)/test/shared/*.*90) | test/shared
Lorenz Huedepohl's avatar
Lorenz Huedepohl committed
52
	@rm -f $@
53
54
	$(call extract_interface,!c>)

55
generated_headers += src/elpa_generated_fortran_interfaces.h
56
src/elpa_generated_fortran_interfaces.h: $(filter-out $(wildcard $(top_srcdir)/src/*generated*), $(wildcard $(top_srcdir)/src/elpa2/kernels/*.c $(top_srcdir)/src/elpa2/kernels/*.s $(top_srcdir)/src/*.[ch] $(top_srcdir)/src/elpa_generalized/*.[ch])) | src
Lorenz Huedepohl's avatar
Lorenz Huedepohl committed
57
	@rm -f $@
58
	$(call extract_interface,!f>)
59
	$(call extract_interface,#!f>)
60

61
generated_headers += src/elpa_generated_public_fortran_interfaces.h
62
src/elpa_generated_public_fortran_interfaces.h: $(filter-out $(wildcard $(top_srcdir)/src/*generated*), $(wildcard $(top_srcdir)/src/*.[ch])) | src
63
64
65
	@rm -f $@
	$(call extract_interface,!pf>)

66
67
generated_headers += src/fortran_constants.F90
src/fortran_constants.F90: $(top_srcdir)/src/fortran_constants.h | src
68
69
70
	@$(CPP) $(CPPFLAGS) -I$(top_builddir)/ -I$(top_srcdir)/ -I. $< -o $@_ || { rm -f $@; exit 1; }
	@awk '/!ELPA_C_DEFINE/ {gsub(/!ELPA_C_DEFINE/, "\n"); gsub(/NEWLINE/, "\n"); print;}' < $@_ > $@ || { rm -f $@; exit 1; }
	@rm $@_
71
72


73
generated-headers: $(generated_headers)
74
75

# vim: syntax=make