Updating to build 46.
[nativeclient.git] / tools / nc_threads / Makefile
blobbb10362ff112b53a34e26286220dac03c6de51a6
1 # Copyright 2008, Google Inc.
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7 #
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
13 # distribution.
14 # * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 # The main target of this directory is the library libpthreads.a
32 # This provides the threads API for NaCl applications
33 all: libpthread.a
36 # The libraries are installed relative to NCCDIR.
38 # Set up paths for tools, etc.
39 NCCDIR ?= /usr/local/nacl-sdk/nacl
40 NCCC=$(NCCDIR)/../bin/nacl-gcc
41 NCAR=$(NCCDIR)/../bin/nacl-ar
43 # TODO: make sure that all SDK libraries use the same flags */
44 NC_CFLAGS += -DNACL_BLOCK_SHIFT=5 \
45 -DGUNIT_NO_GOOGLE3 \
46 -O3 -Werror -Wall -Wswitch-enum -g -fno-builtin \
47 -fno-stack-protector
49 .S.o:
50 $(NCCC) -c $(NC_CFLAGS) -o $@ $<
52 %.o: %.c
53 $(NCCC) -c $(NC_CFLAGS) -o $@ $<
55 .o.nexe:
56 $(NCCC) $(NC_FLAGS) -o $@ -static -lsrpc -lpthread $<
58 ALL_SOURCES=$(NC_THREADS_C_FILES) $(NC_THREADS_ASM_FILES)
60 # C files defining runtime functions.
61 NC_THREADS_C_FILES=nc_thread.c \
62 nc_mutex.c \
63 nc_condvar.c \
64 nc_semaphore.c \
65 nc_hash.c
67 NC_THREADS_C_OBJS=$(NC_THREADS_C_FILES:.c=.o)
69 # Asm files that wrap the entry points into the service runtime.
70 NC_THREADS_ASM_FILES=nacl_mutex.S
71 NC_THREADS_ASM_OBJS=$(NC_THREADS_ASM_FILES:.S=.o)
74 INTERNAL_HEADERS=
75 # was nacl.h
76 SERVICE_RUNTIME_HEADERS=../../service_runtime/nacl_config.h \
77 ../../service_runtime/nacl_syscalls.h
80 libpthread.a: $(NC_THREADS_C_OBJS) $(NC_THREADS_ASM_OBJS)
81 $(NCAR) crs libpthread.a $(NC_THREADS_C_OBJS) $(NC_THREADS_ASM_OBJS)
83 # The headers that get installed in the SDK directory.
84 NC_THREADS_HEADERS=pthread.h nc_system.h atomic_ops.h semaphore.h
86 # Installing the library and header files in the SDK directory.
87 install: libpthread.a $(NC_THREADS_HEADERS)
88 cp libpthread.a $(NCCDIR)/lib
89 -mkdir -p $(NCCDIR)/include
90 cp -f $(NC_THREADS_HEADERS) $(NCCDIR)/include
92 makedep: $(ALL_SOURCES)
93 $(NCCC) -M $(NC_CFLAGS) $(ALL_SOURCES) \
94 > makedep.tmp && mv makedep.tmp makedep
96 clean:
97 rm -f libpthread.a *.o \
98 makedep \
99 *.i *~
101 .PHONY: all clean
103 -include makedep