Skip to content

Commit 0c6c4f5

Browse files
committed
Merge branch 'junghee/fix-makefiles' into 'main'
Add EXEC flag in example Makefiles to be ISA-generic See merge request rewriting/ddisasm!1250
2 parents 46a8207 + 55e9abb commit 0c6c4f5

File tree

7 files changed

+29
-22
lines changed

7 files changed

+29
-22
lines changed

examples/ex_adder/ex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int add(int a, int b)
77
return (a + b);
88
}
99

10-
void main(void)
10+
int main(void)
1111
{
1212
int sum;
1313
int i;
@@ -21,5 +21,5 @@ void main(void)
2121
printf("sum = %d\n", sum);
2222
printf("i = %d\n", i);
2323
}
24-
return;
24+
return 0;
2525
}

examples/ex_data_limit/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
CC="gcc"
22
CFLAGS=
3+
EXEC=
34

45
all: ex.c fun.c
56
$(CC) fun.c -shared $(CFLAGS) -fPIC -o fun.so
67
$(CC) ex.c $(CFLAGS) -no-pie fun.so -o ex
7-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex > out.txt
8+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex > out.txt
89
clean:
910
rm -f ex out.txt fun.so
1011
rm -fr ex.unstripped *.s *.old* dl_files *.gtirb
1112
check:
12-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex >/tmp/res.txt
13+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex >/tmp/res.txt
1314
@ diff out.txt /tmp/res.txt && echo TEST OK

examples/ex_dyn_library/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
CC="gcc"
22
CFLAGS=
3+
EXEC=
34

45
all: ex.c fun.c
5-
$(CC) fun.c -shared $(CFLAGS) -fPIC -o fun.so
6-
$(CC) ex.c $(CFLAGS) fun.so -o ex
7-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex > out.txt
6+
$(CC) fun.c -fPIC -shared $(CFLAGS) -o fun.so
7+
$(CC) ex.c $(CFLAGS) fun.so -o ex
8+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex > out.txt
89
clean:
910
rm -f ex out.txt
1011
rm -fr ex.unstripped *.s *.old* dl_files *.gtirb
1112
check:
12-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex >/tmp/res.txt
13+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex >/tmp/res.txt
1314
@ diff out.txt /tmp/res.txt && echo TEST OK

examples/ex_dyn_library2/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
CC="gcc"
22
CFLAGS=
3+
EXEC=
34

45
all: ex.c fun.c
5-
$(CC) fun.c -shared -lm $(CFLAGS) -o fun.so
6-
$(CC) ex.c $(CFLAGS) fun.so -o ex
7-
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex > out.txt
6+
$(CC) fun.c -fPIC -shared -lm $(CFLAGS) -o fun.so
7+
$(CC) ex.c $(CFLAGS) fun.so -o ex
8+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex > out.txt
89
clean:
910
rm -f ex out.txt
1011
rm -fr ex.unstripped *.s *.old* dl_files *.gtirb
1112
check:
12-
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex >/tmp/res.txt
13+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex >/tmp/res.txt
1314
diff out.txt /tmp/res.txt && echo TEST OK
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
CXX="g++"
2+
EXEC=
3+
24
all: ex.cpp
35
$(CXX) ex.cpp $(CXXFLAGS) -lpthread -o ex
4-
./ex > out.txt
6+
@ $(EXEC) ./ex > out.txt
57
clean:
68
rm -f ex out.txt
79
rm -fr ex.unstripped *.s *.old* dl_files *.gtirb
810
check:
9-
./ex >/tmp/res.txt
11+
@ $(EXEC) ./ex >/tmp/res.txt
1012
@ diff out.txt /tmp/res.txt && echo TEST OK
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
CC="gcc"
22
CFLAGS=
3+
EXEC=
34

45
all: ex.c bar.c data.c fun.c
56
# Put bar.c first to make the `my_strings` defined in bar.c be the first
67
# symbol in the symbol set with the same name.
78
$(CC) bar.c data.c fun.c -shared $(CFLAGS) -fPIC -o fun.so
89
$(CC) ex.c $(CFLAGS) fun.so -o ex
9-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex > out.txt
10+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex > out.txt
1011
clean:
1112
rm -f ex fun.so out.txt
1213
rm -fr ex.unstripped *.s *.old* dl_files *.gtirb
1314
check:
14-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex >/tmp/res.txt
15+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex >/tmp/res.txt
1516
@ diff out.txt /tmp/res.txt && echo TEST OK

examples/ex_symver/Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
CC="gcc"
22
CFLAGS=
3+
EXEC=
34

45
all: ex.c ex2.c ex3.c foo.c
56
$(CC) bar.c -o libbar.so -shared $(CFLAGS) -fPIC -Wl,--version-script=libbar.map
67
$(CC) foo.c libbar.so -o libfoo.so -shared $(CFLAGS) -fPIC -Wl,--version-script=libfoo.map
78
$(CC) ex.c $(CFLAGS) libfoo.so libbar.so -o ex
89
$(CC) ex2.c $(CFLAGS) libfoo.so libbar.so -o ex2
910
$(CC) ex3.c $(CFLAGS) libfoo.so libbar.so -o ex3
10-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex > out.txt
11-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex2 >> out.txt
12-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex3 >> out.txt
11+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex > out.txt
12+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex2 >> out.txt
13+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex3 >> out.txt
1314
clean:
1415
rm -f ex ex2 ex3 libfoo.so libbar.so *.s *.gtirb out.txt
1516
check:
16-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex >/tmp/res.txt
17-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex2 >> /tmp/res.txt
18-
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./ex3 >> /tmp/res.txt
17+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex >/tmp/res.txt
18+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex2 >> /tmp/res.txt
19+
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $(EXEC) ./ex3 >> /tmp/res.txt
1920
@ diff out.txt /tmp/res.txt && echo TEST OK

0 commit comments

Comments
 (0)