Makefile (1702B) - raw
1 2 PREFIX ?= /usr 3 LIBDIR ?= $(PREFIX)/lib64 4 INCLUDEDIR ?= $(PREFIX)/include 5 VAPIDIR ?= $(PREFIX)/share/vala/vapi 6 7 NAME = glibrdf 8 MAJOR_VERSION = 0 9 EXTRA_VERSION = .0.0 10 SONAME = lib$(NAME).so.$(MAJOR_VERSION) 11 LIB = $(SONAME)$(EXTRA_VERSION) 12 REQUIRES = glib-2.0 gobject-2.0 raptor2 redland 13 14 CC = gcc 15 CFLAGS ?= -g -O -Wall 16 CFLAGS += -fPIC -std=c99 -D_XOPEN_SOURCE $(shell pkg-config --cflags $(REQUIRES)) 17 LD = gcc 18 LDFLAGS ?= -Wl,--as-needed -Wl,-O1 19 LIBS = $(shell pkg-config --libs $(REQUIRES)) 20 21 OBJECTS = glibrdf.o 22 TEST_OBJECTS = tests.o test_literal_gvalue.o 23 24 .PHONY: all 25 all: $(LIB) $(NAME).pc 26 27 $(LIB): $(OBJECTS) 28 gcc -shared -Wl,-soname,$(SONAME) $(LDFLAGS) -o $@ $^ $(LIBS) 29 30 %.pc: %.pc.in 31 sed -e 's!@LIBDIR@!$(LIBDIR)!g' \ 32 -e 's!@INCLUDEDIR@!$(INCLUDEDIR)!g' \ 33 -e 's!@VERSION@!$(VERSION)!g' \ 34 -e 's!@REQUIRES@!$(REQUIRES)!g' \ 35 $< >$@ 36 37 glibrdf.o: glibrdf.h 38 39 .PHONY: check 40 check: tests 41 env MALLOC_CHECK_=2 \ 42 G_DEBUG="fatal_warnings fatal_criticals" \ 43 G_SLICE="debug-blocks" \ 44 gtester ./tests --verbose 45 46 tests: $(OBJECTS) $(TEST_OBJECTS) 47 $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) 48 49 test_literal_gvalue.o: glibrdf.h 50 51 .PHONY: clean 52 clean: 53 rm -f $(LIB) $(OBJECTS) $(TEST_OBJECTS) $(NAME).pc 54 55 .PHONY: install 56 install: 57 install -m 0755 -d $(DESTDIR)$(VAPIDIR) 58 install -m 0644 $(NAME).vapi $(DESTDIR)$(VAPIDIR) 59 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR) 60 install -m 0644 glibrdf.h $(DESTDIR)$(INCLUDEDIR) 61 install -m 0755 -d $(DESTDIR)$(LIBDIR)/pkgconfig 62 install -m 0644 $(NAME).pc $(DESTDIR)$(LIBDIR)/pkgconfig 63 install -m 0755 -d $(DESTDIR)$(LIBDIR) 64 install -m 0755 $(LIB) $(DESTDIR)$(LIBDIR) 65 ldconfig -n $(DESTDIR)$(LIBDIR) 66 ln -s $(LIB) $(DESTDIR)$(LIBDIR)/lib$(NAME).so