aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 543ef5d22f092dea6c682f71683f6e046a915ea1 (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
CC = gcc
AR = ar
CFLAGS = -Wall -Wextra -fPIC -Iinclude/

LIBNAME = chttp
SOURCES = $(wildcard src/*.c)
OBJECTS = $(SOURCES:.c=.o)

all: static

static: $(OBJECTS)
	$(AR) rcs $(LIBNAME).a $(OBJECTS)

shared: $(OBJECTS)
	$(CC) -shared -o $(LIBNAME).so $(OBJECTS)

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

install: all
	install -d /usr/local/include/yourlib/
	install include/yourlib/*.h /usr/local/include/yourlib/
	install $(LIBNAME) /usr/local/lib/

clean:
	rm -f src/*.o *.a *.so