Fix installation on Windows.
[morzhol.git] / makefile
blobb4d46ef9e45afb16e9ebd998ea50d4a1d8d9a35a
1 ##############################################################################
2 ## Morzhol ##
3 ## ##
4 ## Copyright (C) 2007 ##
5 ## Pascal Obry - Olivier Ramonat ##
6 ## ##
7 ## This library is free software; you can redistribute it and/or modify ##
8 ## it under the terms of the GNU General Public License as published by ##
9 ## the Free Software Foundation; either version 2 of the License, or (at ##
10 ## your option) any later version. ##
11 ## ##
12 ## This library is distributed in the hope that it will be useful, but ##
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of ##
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
15 ## General Public License for more details. ##
16 ## ##
17 ## You should have received a copy of the GNU General Public License ##
18 ## along with this library; if not, write to the Free Software Foundation, ##
19 ## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ##
20 ##############################################################################
22 GNAT=gnat
23 MKDIR=mkdir
24 CP=cp
25 MODE=Release
27 GNAT_ROOT=$(dir $(shell which gnatls))..
28 INSTALL = $(GNAT_ROOT)
30 # Required for Windows to find the shared library
31 ifeq ($(OS),Windows_NT)
32 export PATH:=$(shell pwd)/lib:$(PATH)
33 endif
35 all:
36 ifneq ($(INSTALL), "")
37 # Write INSTALL target into mk.install (see install target)
38 $(shell echo $(INSTALL) > mk.install)
39 endif
40 $(GNAT) make -p -XPRJ_BUILD=$(MODE) -Pmorzhol
42 setup:
44 check:
45 $(GNAT) check -dd -Pmorzhol -rules -from=morzhol.check
47 regtests:
48 $(GNAT) make -Ptest/test
49 ./test/test
51 clean:
52 -$(GNAT) clean -XPRJ_BUILD=$(MODE) -q -Pmorzhol
53 -$(GNAT) clean -XPRJ_BUILD=$(MODE) -q -Ptest/test
57 ifeq ("$(INSTALL)", "..")
58 # IF GNAT_ROOT is empty and INSTALL var is not set by the user,
59 # the INSTALL var is equal to ".."
60 # In this case, read INSTALL from mk.install. This file is created
61 # before building
62 install: INSTALL = $(shell cat mk.install)
63 endif
65 force:
67 # Set BDIR to .build/#lowercase_mode#
68 install: BDIR = .build/$(shell echo $(MODE) | tr [[:upper:]] [[:lower:]])
69 install: force
70 ifeq ("$(INSTALL)", "")
71 $(error "Wrong install path : empty INSTALL var")
72 endif
73 $(MKDIR) -p $(INSTALL)/include/morzhol
74 $(CP) src/*.ad[sb] $(INSTALL)/include/morzhol
75 $(CP) $(BDIR)/lib/* $(INSTALL)/lib/morzhol
76 $(CP) install.gpr $(INSTALL)/lib/gnat/morzhol.gpr
77 ifeq ($(OS), Windows_NT)
78 $(CP) $(BDIR)/lib/*$(SOEXT) $(INSTALL)/lib
79 endif