File: Makefile

package info (click to toggle)
ocaml 4.05.0-11
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 27,060 kB
  • sloc: ml: 199,255; ansic: 44,187; sh: 5,611; makefile: 4,958; lisp: 4,223; asm: 4,220; awk: 306; perl: 87; fortran: 21; cs: 9; sed: 9
file content (158 lines) | stat: -rw-r--r-- 6,021 bytes parent folder | download
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
#**************************************************************************
#*                                                                        *
#*                                OCaml                                   *
#*                                                                        *
#*                 Xavier Clerc, SED, INRIA Rocquencourt                  *
#*                                                                        *
#*   Copyright 2010 Institut National de Recherche en Informatique et     *
#*     en Automatique.                                                    *
#*                                                                        *
#*   All rights reserved.  This file is distributed under the terms of    *
#*   the GNU Lesser General Public License version 2.1, with the          *
#*   special exception on linking described in the file LICENSE.          *
#*                                                                        *
#**************************************************************************

BASEDIR=../..
EXECNAME=program$(EXE)

ABCDFILES=backtrace.ml
OTHERFILES=backtrace2.ml backtrace3.ml raw_backtrace.ml \
           backtrace_deprecated.ml backtrace_slots.ml
INLININGFILES=inline_test.ml inline_traversal_test.ml
OTHERFILESNOINLINING=pr6920_why_at.ml pr6920_why_swallow.ml
OTHERFILESNOINLINING_NATIVE=backtraces_and_finalizers.ml

# Keep only filenames, lines and character ranges
LOCATIONFILTER=grep -oE \
               '[a-zA-Z_]+\.ml(:[0-9]+)?|(line|characters) [0-9-]+'

default:
	@$(MAKE) byte
	@case `dpkg-architecture -qDEB_BUILD_ARCH` in \
	  sparc|powerpc*) : ;; \
	  *) if $(BYTECODE_ONLY); then $(MAKE) skip ; else $(MAKE) native; fi ;; \
	esac

.PHONY: byte
byte:
	@for file in $(ABCDFILES); do \
	  rm -f program program.exe; \
	  $(OCAMLC) -g -o $(EXECNAME) $$file; \
	  for arg in a b c d ''; do \
	    printf " ... testing '$$file' with ocamlc and argument '$$arg':"; \
	    F="`basename $$file .ml`"; \
	    (OCAMLRUNPARAM=$$OCAMLRUNPARAM,b=1 \
              $(OCAMLRUN) $(EXECNAME) $$arg || true) \
	         >$$F.$$arg.byte.result 2>&1; \
	    $(DIFF) $$F.$$arg.byte.reference $$F.$$arg.byte.result >/dev/null \
	    && echo " => passed" || echo " => failed"; \
	  done; \
	done
	@for file in $(OTHERFILES) $(OTHERFILESNOINLINING); do \
	  rm -f program program.exe; \
	  $(OCAMLC) -g -o $(EXECNAME) $$file; \
	  printf " ... testing '$$file' with ocamlc:"; \
	  F="`basename $$file .ml`"; \
	  (OCAMLRUNPARAM=$$OCAMLRUNPARAM,b=1 \
            $(OCAMLRUN) $(EXECNAME) $$arg || true) \
	       >$$F.byte.result 2>&1; \
	  $(DIFF) $$F.byte.reference $$F.byte.result >/dev/null \
	  && echo " => passed" || echo " => failed"; \
	done;
	@for file in $(INLININGFILES); \
	do \
	  rm -f program program.exe; \
	  $(OCAMLC) -g -o $(EXECNAME) $$file; \
	  printf " ... testing '$$file' with ocamlc:"; \
	  F="`basename $$file .ml`"; \
	  (OCAMLRUNPARAM=$$OCAMLRUNPARAM,b=1 \
	  $(OCAMLRUN) $(EXECNAME) $$arg 2>&1 || true) \
			| $(LOCATIONFILTER) >$$F.byte.result 2>&1; \
	  $(DIFF) $$F.byte.reference $$F.byte.result >/dev/null \
	  && echo " => passed" || echo " => failed"; \
	done

.PHONY: skip
skip:
	@for file in $(ABCDFILES); do \
	  for arg in a b c d ''; do \
	    echo " ... testing '$$file' with ocamlopt and argument '$$arg': \
	=> skipped"; \
	  done; \
	done
	@for file in $(OTHERFILES) $(OTHERFILESNOINLINING) \
	             $(OTHERFILESNOINLINING_NATIVE) $(INLININGFILES); do \
	  echo " ... testing '$$file' with ocamlopt: => skipped"; \
	done

.PHONY: native
native:
	@for file in $(ABCDFILES); do \
	  rm -f program program.exe; \
	  $(OCAMLOPT) -g -o $(EXECNAME) $$file; \
	  for arg in a b c d ''; do \
	    printf " ... testing '$$file' with ocamlopt and argument '$$arg':";\
	    F="`basename $$file .ml`"; \
	    (OCAMLRUNPARAM=$$OCAMLRUNPARAM,b=1 \
              ./$(EXECNAME) $$arg || true) \
	         >$$F.$$arg.native.result 2>&1; \
	    $(DIFF) $$F.$$arg.native.reference $$F.$$arg.native.result \
	            >/dev/null \
	    && echo " => passed" || echo " => failed"; \
	  done; \
	done
	@for file in $(OTHERFILES); do \
	  rm -f program program.exe; \
	  $(OCAMLOPT) -g -o $(EXECNAME) $$file; \
	  printf " ... testing '$$file' with ocamlopt:"; \
	  F="`basename $$file .ml`"; \
	  (OCAMLRUNPARAM=$$OCAMLRUNPARAM,b=1 \
            ./$(EXECNAME) $$arg || true) \
	       >$$F.native.result 2>&1; \
	  $(DIFF) $$F.native.reference $$F.native.result >/dev/null \
	  && echo " => passed" || echo " => failed"; \
	done;
	@for file in $(OTHERFILESNOINLINING) $(OTHERFILESNOINLINING_NATIVE); \
	do \
	  rm -f program program.exe; \
	  $(OCAMLOPT) -inline 0 -g -o $(EXECNAME) $$file; \
	  printf " ... testing '$$file' with ocamlopt:"; \
	  F="`basename $$file .ml`"; \
	  (OCAMLRUNPARAM=$$OCAMLRUNPARAM,b=1 \
            ./$(EXECNAME) $$arg || true) \
	       >$$F.native.result 2>&1; \
	  $(DIFF) $$F.native.reference $$F.native.result >/dev/null \
	  && echo " => passed" || echo " => failed"; \
	done;
	@for file in $(INLININGFILES); \
	do \
	  rm -f program program.exe; \
	  $(OCAMLOPT) -g -o $(EXECNAME) $$file; \
	  printf " ... testing '$$file' with ocamlopt:"; \
	  F="`basename $$file .ml`"; \
	  (OCAMLRUNPARAM=$$OCAMLRUNPARAM,b=1 \
	  ./$(EXECNAME) $$arg 2>&1 || true) \
		 	| $(LOCATIONFILTER) >$$F.native.result; \
	  $(DIFF) $$F.native.reference $$F.native.result >/dev/null \
	  && echo " => passed" || echo " => failed"; \
	  rm -f program program.exe; \
	  $(OCAMLOPT) -g -o $(EXECNAME) -O3 $$file; \
	  printf " ... testing '$$file' with ocamlopt -O3:"; \
	  F="`basename $$file .ml`"; \
	  (OCAMLRUNPARAM=$$OCAMLRUNPARAM,b=1 \
	  ./$(EXECNAME) $$arg 2>&1 || true) \
		 	| $(LOCATIONFILTER) >$$F.O3.result; \
	  $(DIFF) $$F.native.reference $$F.O3.result >/dev/null \
	  && echo " => passed" || echo " => failed"; \
	done


.PHONY: promote
promote: defaultpromote

.PHONY: clean
clean: defaultclean
	@rm -f *.result program program.exe

include $(BASEDIR)/makefiles/Makefile.common