From 18317acfe94228a2f74719705d3ed4300a856f8c Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Mon, 13 Feb 2012 18:01:11 +0100 Subject: [PATCH] Makefile: Add install targets --- Makefile | 37 +++++++++++++++++++++++++++++++++++-- gnat/cuda_ada.gpr | 9 +++++++++ thin/binding.gpr | 2 +- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 gnat/cuda_ada.gpr diff --git a/Makefile b/Makefile index 000307d..92beecf 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,14 @@ +PREFIX ?= $(HOME)/libraries CUDASDK = /usr/local/cuda OBJDIR = obj LIBDIR = lib +SRCDIR = src +THINDIR = thin COVDIR = $(OBJDIR)/cov PERFDIR = perf +GPR_FILES = gnat/*.gpr + LIBRARY_PATH = $(CUDASDK)/lib:$(CUDASDK)/lib64 NUM_CPUS := $(shell getconf _NPROCESSORS_ONLN) @@ -20,6 +25,14 @@ TARBALL = $(CUDA_ADA).tar.bz2 SO_LIBRARY = libcudaada.so.$(VERSION) LIBRARY_KIND = dynamic +SOURCES = \ + $(SRCDIR)/*.ad[bs] \ + $(THINDIR)/*.ad[bs] \ + $(THINDIR)/$(ARCH)/*.ad[bs] +ALIFILES = \ + $(LIBDIR)/*.ali \ + $(OBJDIR)/$(THINDIR)/*.ali + all: build_lib build_lib: @@ -33,6 +46,25 @@ build_tests: @LIBRARY_PATH=$(LIBRARY_PATH) gnatmake $(GMAKE_OPTS) -Pcuda_tests.gpr \ -XARCH=$(ARCH) +install: install_lib install_$(LIBRARY_KIND) + +install_lib: build_lib + install -d $(PREFIX)/include/cuda-ada + install -d $(PREFIX)/lib/cuda-ada + install -d $(PREFIX)/lib/gnat + install -m 644 $(SOURCES) $(PREFIX)/include/cuda-ada + install -m 444 $(ALIFILES) $(PREFIX)/lib/cuda-ada + install -m 644 $(GPR_FILES) $(PREFIX)/lib/gnat + +install_static: + install -m 444 $(LIBDIR)/libcudaada.a $(PREFIX)/lib/cuda-ada + +install_dynamic: + install -m 444 $(LIBDIR)/$(SO_LIBRARY) $(PREFIX)/lib/cuda-ada + cd $(PREFIX)/lib/cuda-ada && \ + ln -sf $(SO_LIBRARY) libcudaada.so && \ + ln -sf $(SO_LIBRARY) libcudaada.so.$(MAJOR) + tests: build_tests @LD_LIBRARY_PATH=$(LIBRARY_PATH) $(OBJDIR)/test_runner @@ -42,7 +74,7 @@ doc: cov: @rm -f $(COVDIR)/*.gcda @LIBRARY_PATH=$(LIBRARY_PATH) gnatmake $(GMAKE_OPTS) -Pcuda_tests.gpr \ - -XBUILD="coverage" + -XARCH=$(ARCH) -XBUILD="coverage" @LD_LIBRARY_PATH=$(LIBRARY_PATH) $(COVDIR)/test_runner || true @lcov -c -d $(COVDIR) -o $(COVDIR)/cov.info @lcov -e $(COVDIR)/cov.info "$(PWD)/src/*.adb" -o $(COVDIR)/cov.info @@ -73,4 +105,5 @@ dist: @echo "Creating release tarball $(TARBALL) ... " @git archive --format=tar HEAD --prefix $(CUDA_ADA)/ | bzip2 > $(TARBALL) -.PHONY: all build_examples build_lib build_tests clean dist doc perf tests +.PHONY: all build_examples build_lib build_tests clean dist doc install \ + install_dynamic install_lib install_static perf tests diff --git a/gnat/cuda_ada.gpr b/gnat/cuda_ada.gpr new file mode 100644 index 0000000..5228d2e --- /dev/null +++ b/gnat/cuda_ada.gpr @@ -0,0 +1,9 @@ +with "templates_parser"; + +project Cuda_Ada is + for Source_Dirs use ("../../include/cuda-ada"); + for Library_Name use "cudaada"; + for Library_Dir use "../../lib/cuda-ada"; + for Library_Kind use "dynamic"; + for Externally_Built use "true"; +end Cuda_Ada; diff --git a/thin/binding.gpr b/thin/binding.gpr index 50572e1..795db43 100644 --- a/thin/binding.gpr +++ b/thin/binding.gpr @@ -5,7 +5,7 @@ project Binding is Arch : Arch_Type := external ("ARCH", "x86_64"); for Source_Dirs use (".", ARCH); - for Object_Dir use "../obj"; + for Object_Dir use "../obj/thin"; Compiler_Switches := ("-gnat05", "-fstack-check", -- 2.30.2