From 0b728575358645f6e9a3f98959dd6995325f7380 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Wed, 2 Mar 2011 23:18:34 +0100 Subject: initial commit --- Makefile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ca0b6b5 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +CC = gcc +CFLAGS ?= -O2 -pipe -Wall -Wextra -Wno-variadic-macros -Wno-strict-aliasing -I$(shell pg_config --includedir) +LDFLAGS ?= -L$(shell pg_config --libdir) +STRIP = strip +INSTALL = install + +LUA_VERSION = 5.1 +PREFIX = /usr/local +LIBDIR = $(PREFIX)/lib/lua/$(LUA_VERSION)/lem + +programs = postgres.so +scripts = queued.lua + +ifdef NDEBUG +DEFINES+=-DNDEBUG +endif + +.PHONY: all strip install indent clean +.PRECIOUS: %.o + +all: $(programs) + +%.o: %.c + @echo ' CC $@' + @$(CC) $(CFLAGS) -I$(PREFIX)/include -fPIC -nostartfiles $(DEFINES) -c $< -o $@ + +%.so: %.o + @echo ' LD $@' + @$(CC) -shared -lpq $(LDFLAGS) $^ -o $@ + +%-strip: % + @echo ' STRIP $<' + @$(STRIP) $< + +strip: $(programs:%=%-strip) + +libdir-install: + @echo " INSTALL -d $(LIBDIR)" + @$(INSTALL) -d $(DESTDIR)$(LIBDIR)/postgres + +%.lua-install: %.lua libdir-install + @echo " INSTALL $<" + @$(INSTALL) $< $(DESTDIR)$(LIBDIR)/postgres/$< + +%.so-install: %.so libdir-install + @echo " INSTALL $<" + @$(INSTALL) $< $(DESTDIR)$(LIBDIR)/$< + +install: $(programs:%=%-install) $(scripts:%=%-install) + +clean: + rm -f $(programs) *.o *.c~ *.h~ -- cgit v1.2.1