File tree 5 files changed +48
-5
lines changed 5 files changed +48
-5
lines changed Original file line number Diff line number Diff line change 2
2
# isn't marked as an executable (target), which CMake requires. Thus construct a
3
3
# path in the same way the symbolic link is created in the goto-cc directory.
4
4
add_test_pl_tests("$<TARGET_FILE_DIR:goto-cc>/goto-gcc" )
5
+
6
+ add_custom_command (OUTPUT "${CMAKE_CURRENT_SOURCE_DIR} /archives/libour_archive.a"
7
+ COMMAND "$<TARGET_FILE_DIR:goto-cc>/goto-gcc" -c foo.c
8
+ COMMAND ${CMAKE_AR} rcs libour_archive.a foo.o
9
+ DEPENDS
10
+ "$<TARGET_FILE_DIR:goto-cc>/goto-gcc"
11
+ "${CMAKE_CURRENT_SOURCE_DIR} /archives/foo.c"
12
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /archives"
13
+ )
14
+
15
+ add_custom_target (libour_archive.a ALL
16
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /archives/libour_archive.a"
17
+ )
Original file line number Diff line number Diff line change 9
9
tests.log : ../test.pl
10
10
11
11
else
12
- test :
13
- -@ln -s goto-cc ../../src/goto-cc/goto-gcc
12
+ test : ../../src/goto-cc/goto-gcc
14
13
@../test.pl -p -c ../../../src/goto-cc/goto-gcc
15
14
16
- tests.log : ../test.pl
17
- -@ln -s goto-cc ../../src/goto-cc/goto-gcc
15
+ tests.log : ../test.pl ../../src/goto-cc/goto-gcc
18
16
@../test.pl -p -c ../../../src/goto-cc/goto-gcc
19
17
18
+ ../../src/goto-cc/goto-gcc : ../../src/goto-cc/goto-cc
19
+ @ln -sf goto-cc ../../src/goto-cc/goto-gcc
20
+
21
+ test tests.log : archives/libour_archive.a
22
+ archives/libour_archive.a : archives/foo.c ../../src/goto-cc/goto-gcc
23
+ @cd archives && \
24
+ ../../../src/goto-cc/goto-gcc -c foo.c && \
25
+ $(AR ) rcs libour_archive.a foo.o
20
26
endif
21
27
22
28
show :
30
36
find -name ' *.out' -execdir $(RM ) ' {}' \;
31
37
find -name ' *.gb' -execdir $(RM ) ' {}' \;
32
38
find -name ' *.goto-cc-saved' -execdir $(RM ) ' {}' \;
33
- $(RM ) tests.log
39
+ $(RM ) tests.log archives/lib_ourarchive.a archives/foo.o
Original file line number Diff line number Diff line change
1
+ int foo ()
2
+ {
3
+ return 0 ;
4
+ }
Original file line number Diff line number Diff line change
1
+ int foo ();
2
+
3
+ int main ()
4
+ {
5
+ return foo ();
6
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ 10
3
+ main.c -L. -lour_archive --verbosity
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^Reading: .*/foo.o$
7
+ --
8
+ ^warning: ignoring
9
+ ^CONVERSION ERROR$
10
+ --
11
+ We need to make sure main.c is listed before the archive for the Linux linker to
12
+ pick up dependencies - thus "main.c" is given as an argument on line 3 in this
13
+ file and the "10" in line 2 is a dummy to be appended at the end, setting the
14
+ verbosity as needed.
You can’t perform that action at this time.
0 commit comments