aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 322c4a5d7f05197801fc3a9d9cc4802221db62f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CC = gcc
LD = gcc
AR = ar

CFLAGS += -Wall -Wextra -g -O0
LDFLAGS +=
CPPFLAGS += -Isrc
LDLIBS += -luv

PLATFORM = $(shell uname -s | tr [A-Z] [a-z])

ifeq ($(findstring mingw32,$(PLATFORM)),mingw32)
LDLIBS += -lws2_32 -lpsapi -liphlpapi
else
endif

all: libuvh.a examples

.PHONY: examples
examples: hello chunked fileserver

libuvh.a: src/uvh.o src/http_parser.o src/sds.o
	$(AR) rcs $@ $^

hello: examples/hello.o libuvh.a
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

chunked: examples/chunked.o libuvh.a
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

fileserver: examples/fileserver.o libuvh.a
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

.PHONY: clean
clean:
	rm -f src/*.o
	rm -f examples/*.o
	rm -f libuvh.a
	rm -f hello
	rm -f chunked
	rm -f fileserver