summaryrefslogtreecommitdiffstats
path: root/tests/run-make-fulldeps/output-type-permutations/Makefile
blob: 791606c643b14e925a6a2f93c95381de7e082335 (plain)
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
include ../tools.mk

all:
	$(RUSTC) foo.rs --crate-type=rlib,dylib,staticlib
	$(call REMOVE_RLIBS,bar)
	$(call REMOVE_DYLIBS,bar)
	rm $(call STATICLIB,bar)
	rm -f $(TMPDIR)/{lib,}bar.{dll.exp,dll.lib,pdb,dll.a}
	# Check that $(TMPDIR) is empty.
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --crate-type=bin
	rm $(TMPDIR)/$(call BIN,bar)
	rm -f $(TMPDIR)/bar.pdb
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link
	rm $(TMPDIR)/bar.ll
	rm $(TMPDIR)/bar.bc
	rm $(TMPDIR)/bar.s
	rm $(TMPDIR)/bar.o
	rm $(TMPDIR)/$(call BIN,bar)
	rm -f $(TMPDIR)/bar.pdb
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit asm -o $(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --emit asm=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --emit=asm=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit llvm-bc -o $(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --emit llvm-bc=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --emit=llvm-bc=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit llvm-ir -o $(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --emit=llvm-ir=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit obj -o $(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --emit obj=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --emit=obj=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit link -o $(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	$(RUSTC) foo.rs --emit link=$(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	$(RUSTC) foo.rs --emit=link=$(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	rm -f $(TMPDIR)/foo.pdb
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --crate-type=rlib --emit link=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --crate-type=rlib --emit=link=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --crate-type=dylib -o $(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	$(RUSTC) foo.rs --crate-type=dylib --emit link=$(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	$(RUSTC) foo.rs --crate-type=dylib --emit=link=$(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	rm -f $(TMPDIR)/{lib,}foo.{dll.exp,dll.lib,pdb,dll.a,exe.a}
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] || (ls -1 $(TMPDIR) && exit 1)

	$(RUSTC) foo.rs --crate-type=staticlib -o $(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --crate-type=staticlib --emit link=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	$(RUSTC) foo.rs --crate-type=staticlib --emit=link=$(TMPDIR)/foo
	rm $(TMPDIR)/foo
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --crate-type=bin -o $(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	$(RUSTC) foo.rs --crate-type=bin --emit link=$(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	$(RUSTC) foo.rs --crate-type=bin --emit=link=$(TMPDIR)/$(call BIN,foo)
	rm $(TMPDIR)/$(call BIN,foo)
	rm -f $(TMPDIR)/foo.pdb
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/ir \
			--emit link \
			--crate-type=rlib
	rm $(TMPDIR)/ir
	rm $(TMPDIR)/libbar.rlib
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit asm=$(TMPDIR)/asm \
			--emit llvm-ir=$(TMPDIR)/ir \
			--emit llvm-bc=$(TMPDIR)/bc \
		        --emit obj=$(TMPDIR)/obj \
			--emit link=$(TMPDIR)/link \
			--crate-type=staticlib
	rm $(TMPDIR)/asm
	rm $(TMPDIR)/ir
	rm $(TMPDIR)/bc
	rm $(TMPDIR)/obj
	rm $(TMPDIR)/link
	$(RUSTC) foo.rs --emit=asm=$(TMPDIR)/asm \
			--emit llvm-ir=$(TMPDIR)/ir \
			--emit=llvm-bc=$(TMPDIR)/bc \
		        --emit obj=$(TMPDIR)/obj \
			--emit=link=$(TMPDIR)/link \
			--crate-type=staticlib
	rm $(TMPDIR)/asm
	rm $(TMPDIR)/ir
	rm $(TMPDIR)/bc
	rm $(TMPDIR)/obj
	rm $(TMPDIR)/link
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]

	$(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link --crate-type=staticlib
	rm $(TMPDIR)/bar.ll
	rm $(TMPDIR)/bar.s
	rm $(TMPDIR)/bar.o
	rm $(call STATICLIB,bar)
	mv $(TMPDIR)/bar.bc $(TMPDIR)/foo.bc
	# Don't check that the $(TMPDIR) is empty - we left `foo.bc` for later
	# comparison.

	$(RUSTC) foo.rs --emit=llvm-bc,link --crate-type=rlib
	cmp $(TMPDIR)/foo.bc $(TMPDIR)/bar.bc
	rm $(TMPDIR)/bar.bc
	rm $(TMPDIR)/foo.bc
	$(call REMOVE_RLIBS,bar)
	[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]