summary refs log tree commit diff
path: root/Makefile
blob: 5df7ef8450491e01dc5f456b0c6e277cc68268cb (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
include config.mk

OBJS += obj/header.o
OBJS += obj/libhttpc.o
OBJS += obj/malloc.o
OBJS += obj/method.o
OBJS += obj/request.o
OBJS += obj/response.o
OBJS += obj/status.o

all: libhttpc.a libhttpc.so

obj:
	mkdir -p $@

obj/%.o: src/%.c | obj
	${CC} -c -std=c99 -fPIC -Iinclude -o $@ ${CFLAGS} $<

${OBJS}: include/libhttpc.h

libhttpc.a libhttpc.so: ${OBJS}

libhttpc.so:
	cc -shared -o $@ ${LDFLAGS} ${LDLIBS} $^

libhttpc.a:
	ar rcs $@ $^

install: all
	install -d $(DESTDIR)/lib ${DESTDIR}/include/libhttpc
	install -m644 libhttpc.a $(DESTDIR)/lib
	install -m755 libhttpc.so $(DESTDIR)/lib
	install -m644 include/{config,libhttpc}.h $(DESTDIR)/include/libhttpc

uninstall:
	$(RM) $(DESTDIR)/lib/libhttpc.{a,so}
	$(RM) -r $(DESTDIR)/include/libhttpc/

clean:
	rm -f ${OBJS} libhttpc.a libhttpc.so