summaryrefslogtreecommitdiff
path: root/Makefile
blob: 32976d772956b2dd1bf2e17b81b1d7eeac86139e (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 ?= cc
CFLAGS=-std=c99 -W -Wall -pedantic -O2 -Iinclude -fPIC
OBJS=fhp.o hash.o error.o token.o env.o
SONAME=libfhp.so
LIB=libfhp.so

TEST_OBJS=test.o
TEST_APP=./fhp-test
TEST_LDFLAGS=-lfhp -L.

all: $(LIB)

test: $(TEST_APP)
	LD_LIBRARY_PATH=. $(TEST_APP)

clean:
	rm -f $(LIB) $(OBJS) $(TEST_APP) $(TEST_OBJS)

$(LIB): $(OBJS)
	$(CC) -o $(LIB) -shared -Wl,-soname,$(SONAME) $(OBJS)

$(TEST_APP): $(LIB) $(TEST_OBJS)
	$(CC) -o $(TEST_APP) $(TEST_OBJS) $(TEST_LDFLAGS)

%.o: %.c include/fhp/fhp.h
	$(CC) -c $(CFLAGS) $<