| 1 | # The top-level Makefile that is used to build |
|---|
| 2 | |
|---|
| 3 | # setup variables from configure |
|---|
| 4 | prefix = @prefix@ |
|---|
| 5 | exec_prefix = @exec_prefix@ |
|---|
| 6 | libdir = @libdir@ |
|---|
| 7 | includedir = @includedir@ |
|---|
| 8 | |
|---|
| 9 | # pkg-config dirs |
|---|
| 10 | pkgconfigdir = @libdir@/pkgconfig |
|---|
| 11 | |
|---|
| 12 | # Python build control |
|---|
| 13 | BUILD_FOR_PYTHON=@BUILD_FOR_PYTHON@ |
|---|
| 14 | PY_DEFAULT := @PY_DEFAULT@ |
|---|
| 15 | PY_VERSIONS := $(sort @PY_VERSIONS@ $(PY_DEFAULT)) |
|---|
| 16 | |
|---|
| 17 | VERSION = @VERSION@ |
|---|
| 18 | |
|---|
| 19 | SUBDIRS := c |
|---|
| 20 | ifeq ($(BUILD_FOR_PYTHON),yes) |
|---|
| 21 | SUBDIRS += python |
|---|
| 22 | endif |
|---|
| 23 | SUBDIRS += tests |
|---|
| 24 | |
|---|
| 25 | ifdef PRINT_DIRECTORIES |
|---|
| 26 | MAKE_CMD = $(MAKE) -j -l 5.0 |
|---|
| 27 | MAKE_DIR = $(MAKE_CMD) -C $(dir) |
|---|
| 28 | else |
|---|
| 29 | MAKE_CMD = $(MAKE) -j -l 5.0 --no-print-directory -s |
|---|
| 30 | MAKE_DIR = $(MAKE_CMD) -C $(dir) |
|---|
| 31 | endif |
|---|
| 32 | |
|---|
| 33 | LIBS_DIR = @RDFADIR@/libs |
|---|
| 34 | |
|---|
| 35 | .PHONY: all verbose clean test docs install-python |
|---|
| 36 | |
|---|
| 37 | all: docs |
|---|
| 38 | @$(foreach dir,$(SUBDIRS),$(MAKE_DIR) \ |
|---|
| 39 | build-objects build-libraries \ |
|---|
| 40 | PY_VERSIONS="$(PY_VERSIONS)" \ |
|---|
| 41 | PY_DEFAULT="$(PY_DEFAULT)" &&) true |
|---|
| 42 | @$(foreach dir,$(SUBDIRS),$(MAKE_DIR) \ |
|---|
| 43 | build-executables &&) true |
|---|
| 44 | |
|---|
| 45 | clean: |
|---|
| 46 | @$(foreach dir,$(SUBDIRS),MAKE_CLEAN_ACTIVE=true $(MAKE_DIR) clean &&) true |
|---|
| 47 | @rm -rf libs/* |
|---|
| 48 | @rm -rf installers/packages |
|---|
| 49 | @echo "Removed all objects and libraries." |
|---|
| 50 | |
|---|
| 51 | tests: all |
|---|
| 52 | LD_LIBRARY_PATH=@RDFADIR@/libs tests/dist/curies |
|---|
| 53 | LD_LIBRARY_PATH=@RDFADIR@/libs tests/dist/rdfa2n3 tests/testsuite/0001.xhtml |
|---|
| 54 | |
|---|
| 55 | docs: |
|---|
| 56 | @$(MAKE_DIR) docs |
|---|
| 57 | |
|---|
| 58 | install-librdfa: |
|---|
| 59 | @echo "Installing librdfa libraries to $(DESTDIR)$(libdir) ..." |
|---|
| 60 | @install -d $(DESTDIR)$(libdir) |
|---|
| 61 | @install -m 644 $(LIBS_DIR)/librdfa.so $(DESTDIR)$(libdir)/librdfa.so.$(VERSION) |
|---|
| 62 | @ln -sf librdfa.so.$(VERSION) $(DESTDIR)$(libdir)/librdfa.so |
|---|
| 63 | |
|---|
| 64 | install-librdfa-dev: |
|---|
| 65 | @echo "Installing librdfa development support to $(DESTDIR)$(libdir) ..." |
|---|
| 66 | @install -d $(DESTDIR)$(libdir) |
|---|
| 67 | @install -d $(DESTDIR)$(includedir) |
|---|
| 68 | @install -d $(DESTDIR)$(pkgconfigdir) |
|---|
| 69 | @install -m 644 $(LIBS_DIR)/librdfa.a $(DESTDIR)$(libdir)/librdfa.a |
|---|
| 70 | @install -m 644 c/rdfa.h $(DESTDIR)$(includedir) |
|---|
| 71 | @install -m 644 c/rdfa_utils.h $(DESTDIR)$(includedir) |
|---|
| 72 | @install -m 644 librdfa.pc $(DESTDIR)$(pkgconfigdir) |
|---|
| 73 | |
|---|
| 74 | # FIXME: this should install to site-packages for 2.5 and dist-packages for 2.6 |
|---|
| 75 | ifeq ($(BUILD_FOR_PYTHON),yes) |
|---|
| 76 | install-python%: |
|---|
| 77 | echo "Installing python extensions to $(DESTDIR)$(libdir)/python$*/site-packages ..." |
|---|
| 78 | install -d $(DESTDIR)$(libdir)/python$*/site-packages |
|---|
| 79 | install -m 644 python/dist/rdfa.py $(DESTDIR)$(libdir)/python$*/site-packages |
|---|
| 80 | install -m 644 python/dist/python$*-rdfa.so $(DESTDIR)$(libdir)/python$*/site-packages/_rdfa.so |
|---|
| 81 | install-python: $(PY_VERSIONS:%=install-python%) |
|---|
| 82 | else |
|---|
| 83 | install-python: |
|---|
| 84 | endif |
|---|
| 85 | |
|---|
| 86 | packages: |
|---|
| 87 | @echo "Generating Debian packages..." |
|---|
| 88 | @ln -sf installers/debian debian |
|---|
| 89 | @dpkg-buildpackage -us -uc -rfakeroot |
|---|
| 90 | @mkdir -p installers/packages |
|---|
| 91 | @mv ../*rdfa*@RELEASE@*deb installers/packages |
|---|
| 92 | @echo "Generating RPM packages..." |
|---|
| 93 | @cd installers/packages && fakeroot alien --to-rpm -k --scripts *deb |
|---|
| 94 | @echo "Generating TGZ packages..." |
|---|
| 95 | @cd installers/packages && fakeroot alien --to-tgz -k --scripts *deb |
|---|
| 96 | @echo "Generating Solaris packages..." |
|---|
| 97 | @cd installers/packages && fakeroot alien --to-pkg -k --scripts *deb |
|---|
| 98 | @echo "Generating Stampede packages..." |
|---|
| 99 | @cd installers/packages && fakeroot alien --to-slp -k --scripts *deb |
|---|
| 100 | |
|---|
| 101 | ifeq (@OS@,mingw32) |
|---|
| 102 | install-windows: |
|---|
| 103 | @echo "Generating Windows ZIP release..." |
|---|
| 104 | @mkdir -p installers/librdfa-windows-@RELEASE@ |
|---|
| 105 | @cp c/rdfa.h installers/librdfa-windows-@RELEASE@ |
|---|
| 106 | @cp c/rdfa_utils.h installers/librdfa-windows-@RELEASE@ |
|---|
| 107 | @cp libs/rdfa.dll installers/librdfa-windows-@RELEASE@ |
|---|
| 108 | @cp libs/rdfa.lib installers/librdfa-windows-@RELEASE@ |
|---|
| 109 | @cd installers && zip -r librdfa-@VERSION@-windows-@RELEASE@.zip \ |
|---|
| 110 | librdfa-windows-@RELEASE@ |
|---|
| 111 | @rm -rf installers/librdfa-windows-@RELEASE@ |
|---|
| 112 | endif |
|---|
| 113 | |
|---|
| 114 | ifeq (@OS@,macos) |
|---|
| 115 | install-macos: |
|---|
| 116 | @echo "Generating Mac OS X ZIP release..." |
|---|
| 117 | @mkdir -p installers/librdfa-macos-@RELEASE@ |
|---|
| 118 | @cp c/rdfa.h installers/librdfa-macos-@RELEASE@ |
|---|
| 119 | @cp c/rdfa_utils.h installers/librdfa-macos-@RELEASE@ |
|---|
| 120 | @cp libs/librdfa.dylib installers/librdfa-macos-@RELEASE@ |
|---|
| 121 | @cp libs/librdfa.a installers/librdfa-macos-@RELEASE@ |
|---|
| 122 | @cd installers && zip -r librdfa-@VERSION@-macos-@RELEASE@.zip \ |
|---|
| 123 | librdfa-macos-@RELEASE@ |
|---|
| 124 | @rm -rf installers/librdfa-macos-@RELEASE@ |
|---|
| 125 | endif |
|---|
| 126 | |
|---|
| 127 | |
|---|
| 128 | install: install-librdfa install-librdfa-dev install-python |
|---|
| 129 | |
|---|
| 130 | verbose: |
|---|
| 131 | PRINT_DIRECTORIES=true $(MAKE) all |
|---|