| OLD | NEW |
| 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # TODO(hamaji): include $NACL_SDK_ROOT/tools/common.mk. | 5 # TODO(hamaji): include $NACL_SDK_ROOT/tools/common.mk. |
| 6 | 6 |
| 7 NACL_SPAWN_OBJS=nacl_spawn.o path_util.o | 7 NACL_SPAWN_OBJS=nacl_spawn.o path_util.o |
| 8 # For now, we do not support spawning a new glibc process from newlib. | 8 # For now, we do not support spawning a new glibc process from newlib. |
| 9 | 9 |
| 10 NACL_SPAWN_OBJS+=elf_reader.o library_dependencies.o | 10 NACL_SPAWN_OBJS+=elf_reader.o library_dependencies.o |
| 11 | 11 |
| 12 TEST_EXES=test/elf_reader test/library_dependencies | 12 TEST_EXES=test/elf_reader test/library_dependencies |
| 13 TEST_BINARIES=test/test_exe test/libtest1.so test/libtest2.so test/libtest3.so | 13 TEST_BINARIES=test/test_exe test/libtest1.so test/libtest2.so test/libtest3.so |
| 14 | 14 |
| 15 all: test | 15 all: test |
| 16 | 16 |
| 17 # Targets for libcli_main | 17 # Targets for libcli_main |
| 18 | 18 |
| 19 libcli_main.a: cli_main.o nacl_startup_untar.o | 19 libcli_main.a: cli_main.o nacl_startup_untar.o |
| 20 rm -f $@ | 20 rm -f $@ |
| 21 $(NACLAR) rcs $@ $^ | 21 $(NACLAR) rcs $@ $^ |
| 22 | 22 |
| 23 libcli_main.so: cli_main.o nacl_startup_untar.o |
| 24 $(NACLCXX) $(LDFLAGS) -shared $^ -o $@ |
| 25 |
| 23 cli_main.o: cli_main.c | 26 cli_main.o: cli_main.c |
| 24 $(NACLCC) $(CFLAGS) -c $< -o $@ | 27 $(NACLCC) $(CFLAGS) -c $< -o $@ |
| 25 | 28 |
| 26 nacl_startup_untar.o: nacl_startup_untar.c | 29 nacl_startup_untar.o: nacl_startup_untar.c |
| 27 $(NACLCC) $(CFLAGS) -c $< -o $@ | 30 $(NACLCC) $(CFLAGS) -c $< -o $@ |
| 28 | 31 |
| 29 # Targets for libnacl_spawn | 32 # Targets for libnacl_spawn |
| 30 | 33 |
| 31 libnacl_spawn.so: $(NACL_SPAWN_OBJS) | 34 libnacl_spawn.so: $(NACL_SPAWN_OBJS) |
| 32 $(NACLCXX) $(LDFLAGS) -shared $^ -o $@ | 35 $(NACLCXX) $(LDFLAGS) -shared $^ -o $@ |
| 33 | 36 |
| 34 libnacl_spawn.a: $(NACL_SPAWN_OBJS) | 37 libnacl_spawn.a: $(NACL_SPAWN_OBJS) |
| 35 rm -f $@ | 38 rm -f $@ |
| 36 $(NACLAR) rcs $@ $^ | 39 $(NACLAR) rcs $@ $^ |
| 37 | 40 |
| 38 %.o: %.cc | 41 %.o: %.cc |
| 39 $(NACLCXX) $(CXXFLAGS) -c $< -o $@ | 42 $(NACLCXX) $(CXXFLAGS) -c $< -o $@ |
| 40 | 43 |
| 41 # Targets for tests | 44 # Targets for tests |
| 42 | 45 |
| 43 test: $(TEST_EXES) $(TEST_BINARIES) | 46 test: $(TEST_EXES) $(TEST_BINARIES) |
| 44 ./test/run_test.sh | 47 ./test/run_test.sh |
| 45 | 48 |
| 46 test/elf_reader: elf_reader.cc | 49 test/elf_reader: elf_reader.cc |
| 47 » $(NACLCXX) -DDEFINE_ELF_READER_MAIN $< -o $@ | 50 » $(NACLCXX) $(LDFLAGS) $(CXXFLAGS) -DDEFINE_ELF_READER_MAIN $< -o $@ |
| 48 test/library_dependencies: elf_reader.o path_util.o library_dependencies.cc | 51 test/library_dependencies: elf_reader.o path_util.o library_dependencies.cc |
| 49 » $(NACLCXX) -DDEFINE_LIBRARY_DEPENDENCIES_MAIN $^ -o $@ | 52 » $(NACLCXX) $(LDFLAGS) $(CXXFLAGS) -DDEFINE_LIBRARY_DEPENDENCIES_MAIN $^
-o $@ |
| 50 | 53 |
| 51 # We use -nostdlib not to have libc.so in their dependencies. | 54 # We use -nostdlib not to have libc.so in their dependencies. |
| 52 test/test_exe: test/test_exe.c test/libtest1.so test/libtest2.so | 55 test/test_exe: test/test_exe.c test/libtest1.so test/libtest2.so |
| 53 $(NACLCC) $< -nostdlib -Wl,-rpath-link=test -Ltest -ltest1 -ltest2 -o $@ | 56 $(NACLCC) $< -nostdlib -Wl,-rpath-link=test -Ltest -ltest1 -ltest2 -o $@ |
| 54 test/libtest1.so: test/libtest1.c test/libtest3.so | 57 test/libtest1.so: test/libtest1.c test/libtest3.so |
| 55 $(NACLCC) $< -fPIC -nostdlib -shared -Ltest -ltest3 -o $@ | 58 $(NACLCC) $< -fPIC -nostdlib -shared -Ltest -ltest3 -o $@ |
| 56 test/libtest2.so: test/libtest2.c test/libtest3.so | 59 test/libtest2.so: test/libtest2.c test/libtest3.so |
| 57 $(NACLCC) $< -fPIC -nostdlib -shared -Ltest -ltest3 -o $@ | 60 $(NACLCC) $< -fPIC -nostdlib -shared -Ltest -ltest3 -o $@ |
| 58 test/libtest3.so: test/libtest3.c | 61 test/libtest3.so: test/libtest3.c |
| 59 $(NACLCC) $< -fPIC -nostdlib -shared -o $@ | 62 $(NACLCC) $< -fPIC -nostdlib -shared -o $@ |
| 60 | 63 |
| 61 clean: | 64 clean: |
| 62 rm -f *.a *.o *.so $(TEST_EXES) $(TEST_BINARIES) | 65 rm -f *.a *.o *.so $(TEST_EXES) $(TEST_BINARIES) |
| OLD | NEW |