summaryrefslogblamecommitdiffstats
path: root/Makefile
blob: d8858a4718090b620ab238fa2460c0eb5942490f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                            

      


           




                               
                                       
                                         
                                                               
























                                                                              
TARGET:=libts3db_postgres.so
TOP:=.

#32BIT=-m32
#DEBUG=-g

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

CFLAGS=-fPIC $(32BIT) $(DEBUG) -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 $@