]> git.wh0rd.org - chrome-ext/crftp.git/blame - pnacl/Makefile
init
[chrome-ext/crftp.git] / pnacl / Makefile
CommitLineData
769a03c3
MF
1CROSS_COMPILE = $(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-
2CC = $(CROSS_COMPILE)clang
3CXX = $(CROSS_COMPILE)clang++
4FINALIZE = $(CROSS_COMPILE)finalize
5STRIP = $(CROSS_COMPILE)strip
6ABICHECK = $(CROSS_COMPILE)abicheck
7CREATE_NMF = $(NACL_SDK_ROOT)/tools/create_nmf.py
8
9DEFAULT_FLAGS = -O2 -g -pipe
10CFLAGS ?= $(DEFAULT_FLAGS)
11CFLAGS += -Wall -pthread -ffunction-sections -fdata-sections
12CPPFLAGS += \
13 -D__UINT64_MAX \
14 -D__unix__ \
15 -I. \
16 -I$(PWD)/util
17
18# Now pull in the system code.
19CPPFLAGS += -I$(NACL_SDK_ROOT)/include -I$(NACL_SDK_ROOT)/include/newlib
20LDFLAGS += -L$(NACL_SDK_ROOT)/lib/pnacl/Release
21# We only use ppapi, but nacl_io needs ppapi_cpp.
22LDLIBS += -lppapi -lnacl_io -lppapi_cpp
23
24SRCS = ftplib.c ppapi.c queue.c inet_addr.c
25OBJS = $(SRCS:.c=.o)
26
27all: crftp.nmf
28
29%.nmf: %.pexe
30 $(CREATE_NMF) $< > $@
31
32%.pexe: %.bc
33 $(FINALIZE) -o $@ $<
34# The ABI checker segfaults currently.
35# $(ABICHECK) $@
36
37crftp.bc: $(OBJS)
38 $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
39
40clean:
41 rm -f *.pexe *.nmf *.bc *.o
42
43httpd:
44 $(NACL_SDK_ROOT)/tools/httpd.py -C $(PWD) -p 7000 --no-dir-check >/dev/null 2>&1 &
45
46VPATH = ftplib util
47
48-include .depend
49.depend: $(SRCS)
50 $(CC) $(CPPFLAGS) -MM $^ > $@
51
52.PHONY: all clean
53.PRECIOUS: %.pexe