summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 8272d2c1d1154b28720c2c9ea2d54fafd6d79469 (plain) (blame)
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
TARGET:=libts3db_own.so
TOP:=.

headers:=$(wildcard ${TOP}/*.h)
sources:=$(wildcard ${TOP}/*.c)
deps:=$(sources:.c=.d)
objects:=$(sources:.c=.o)


#32BIT=-m32
CFLAGS=-fPIC $(32BIT) -g -std=c99
CFLAGS+=-I$(shell pg_config --includedir)
LDFLAGS=-shared -Wl,-soname,$(TARGET) $(32BIT) -lpq -liniparser

##############################################################################

.PHONY:	all clean

all:	$(TARGET)

clean:
	-$(RM) -r $(TARGET) $(objects) $(deps)

ifneq ($(MAKECMDGOALS),clean)
-include $(deps)
endif

##############################################################################
# normal build

$(TARGET):	$(objects) $(deps)
	$(CC) $(LDFLAGS) -o $(TARGET) $(objects)

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

%.d:		%.c
	$(CC) $(CFLAGS) -MM -c $< -MF $@