1 1.1 christos examples=\ 2 1.1 christos helloworld\ 3 1.1 christos default-loop\ 4 1.1 christos idle-basic\ 5 1.1 christos uvcat\ 6 1.1 christos uvtee\ 7 1.1 christos onchange\ 8 1.1 christos thread-create\ 9 1.1 christos queue-work\ 10 1.1 christos progress\ 11 1.1 christos tcp-echo-server\ 12 1.1 christos dns\ 13 1.1 christos udp-dhcp\ 14 1.1 christos idle-compute\ 15 1.1 christos ref-timer\ 16 1.1 christos spawn\ 17 1.1 christos detach\ 18 1.1 christos proc-streams\ 19 1.1 christos cgi\ 20 1.1 christos pipe-echo-server\ 21 1.1 christos multi-echo-server\ 22 1.1 christos tty\ 23 1.1 christos tty-gravity\ 24 1.1 christos interfaces\ 25 1.1 christos locks \ 26 1.1 christos signal \ 27 1.1 christos uvstop \ 28 1.1 christos queue-cancel 29 1.1 christos 30 1.1 christos UV_PATH=$(shell pwd)/../.. 31 1.1 christos UV_LIB=$(UV_PATH)/.libs/libuv.a 32 1.1 christos CFLAGS=-g -Wall -I$(UV_PATH)/include 33 1.1 christos LIBS= 34 1.1 christos 35 1.1 christos uname_S=$(shell uname -s) 36 1.1 christos 37 1.1 christos ifeq (Darwin, $(uname_S)) 38 1.1 christos CFLAGS+=-framework CoreServices 39 1.1 christos SHARED_LIB_FLAGS=-bundle -undefined dynamic_lookup -o plugin/libhello.dylib 40 1.1 christos endif 41 1.1 christos 42 1.1 christos ifeq (Linux, $(uname_S)) 43 1.1 christos LIBS=-lrt -ldl -lm -pthread -lcurl 44 1.1 christos SHARED_LIB_FLAGS=-shared -Wl,-soname,libhello.so -o plugin/libhello.so 45 1.1 christos PLUGIN_EXE_FLAGS=-Wl,-export-dynamic 46 1.1 christos endif 47 1.1 christos 48 1.1 christos 49 1.1 christos all: $(examples) plugin/plugin proc-streams/test cgi/tick multi-echo-server/worker uvwget/uvwget 50 1.1 christos 51 1.1 christos $(examples): % : %/main.c 52 1.1 christos gcc $(CFLAGS) -o $@/$@ $< $(UV_LIB) $(LIBS) 53 1.1 christos 54 1.1 christos plugin: plugin/plugin 55 1.1 christos plugin/plugin: plugin/*.c 56 1.1 christos gcc $(CFLAGS) $(PLUGIN_EXE_FLAGS) -o plugin/plugin plugin/main.c $(UV_LIB) $(LIBS) 57 1.1 christos gcc -g -Wall -c -fPIC -o plugin/hello.o plugin/hello.c 58 1.1 christos gcc $(SHARED_LIB_FLAGS) plugin/hello.o 59 1.1 christos 60 1.1 christos proc-streams/test: proc-streams/test.c 61 1.1 christos gcc -g -Wall -o proc-streams/test proc-streams/test.c 62 1.1 christos 63 1.1 christos cgi/tick: cgi/tick.c 64 1.1 christos gcc -g -Wall -o cgi/tick cgi/tick.c 65 1.1 christos 66 1.1 christos multi-echo-server/worker: multi-echo-server/worker.c 67 1.1 christos gcc $(CFLAGS) -o multi-echo-server/worker multi-echo-server/worker.c $(UV_LIB) $(LIBS) 68 1.1 christos 69 1.1 christos uvwget: uvwget/uvwget 70 1.1 christos uvwget/uvwget: uvwget/main.c 71 1.1 christos gcc $(CFLAGS) `curl-config --cflags --libs` -o uvwget/uvwget uvwget/main.c $(UV_LIB) $(LIBS) 72 1.1 christos 73 1.1 christos clean: 74 1.1 christos for dir in $(examples); do cd $$dir; rm -f $$dir; rm -rf $$dir.dSYM; cd ..; done 75 1.1 christos rm -rf plugin/*.o plugin/libhello.* 76 1.1 christos rm -rf plugin/plugin plugin/plugin.dSYM 77 1.1 christos rm -rf proc-streams/test proc-streams/test.dSYM 78 1.1 christos rm -rf cgi/tick cgi/tick.dSYM 79 1.1 christos rm -rf multi-echo-server/worker multi-echo-server/worker.dSYM 80 1.1 christos rm -rf uvwget/uvwget uvwget/uvwget.dSYM 81 1.1 christos 82 1.1 christos .PHONY: clean all $(examples) plugin uvwget 83