File: Makefile

package info (click to toggle)
pcscada 0.7.1-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 524 kB
  • sloc: ada: 3,310; makefile: 115
file content (128 lines) | stat: -rw-r--r-- 3,247 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#
#  Copyright (c) 2008-2012,
#  Reto Buerki <reet@codelabs.ch>
#
#  This file is part of PCSC/Ada.
#
#  PCSC/Ada is free software; you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License as published
#  by the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
#  PCSC/Ada is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with PCSC/Ada; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
#  MA  02110-1301  USA
#

PREFIX ?= $(HOME)/libraries
INCDIR  = $(PREFIX)/share/ada/adainclude/pcscada
ALIDIR  = $(PREFIX)/lib/ada/adalib/pcscada

INSTALL = install

MAJOR   = 0
MINOR   = 7
REV     = 1
VERSION = $(MAJOR).$(MINOR).$(REV)
PCSCADA = libpcscada-$(VERSION)

LIBRARY_KIND = dynamic

SOURCEDIR  = src
DOCDIR     = doc/html
ALI_FILES  = lib/$(LIBRARY_KIND)/*.ali
SO_LIBRARY = libpcscada.so.$(VERSION)
A_LIBRARY  = libpcscada.a

TMPDIR  = /tmp
DISTDIR = $(TMPDIR)/$(PCSCADA)
TARBALL = $(PCSCADA).tar.bz2

all: build_lib

build_lib: prepare
	@gnatmake -p -Ppcscada_lib -XPCSCADA_VERSION="$(VERSION)" \
		-XLIBRARY_KIND="$(LIBRARY_KIND)"

build_utests: prepare
	@gnatmake -p -Ppcscada_utests

build_itests: prepare
	@gnatmake -p -Ppcscada_itests

build_examples: prepare
	@gnatmake -p -Ppcscada_examples

prepare: $(SOURCEDIR)/pcsc-version.ads

$(SOURCEDIR)/pcsc-version.ads:
	@echo "package PCSC.Version is"                 > $@
	@echo "   Version_String : constant String :=" >> $@
	@echo "     \"$(VERSION)\";"                   >> $@
	@echo "end PCSC.Version;"                      >> $@

clean:
	@rm -rf obj/*
	@rm -rf lib/*
	$(MAKE) -C doc clean

distclean:
	@rm -rf obj
	@rm -rf lib
	@rm -rf $(DOCDIR)
	@rm -f $(SOURCEDIR)/pcsc-version.ads

# run unit tests
utests: build_utests
	@obj/utests/runner

# run 'integration' tests
# you need a reader and smartcard for this to work
itests: build_itests
	@obj/itests/test_pcscada

examples: build_examples

install: install_lib install_$(LIBRARY_KIND)

install_lib: build_lib
	@mkdir -p $(INCDIR)
	@mkdir -p $(ALIDIR)
	$(INSTALL) -m 644 $(SOURCEDIR)/* $(INCDIR)
	$(INSTALL) -m 444 $(ALI_FILES) $(ALIDIR)

install_static:
	$(INSTALL) -m 444 lib/$(LIBRARY_KIND)/$(A_LIBRARY) $(PREFIX)/lib

install_dynamic:
	$(INSTALL) -m 444 lib/$(LIBRARY_KIND)/$(SO_LIBRARY) $(PREFIX)/lib
	@cd $(PREFIX)/lib && \
		ln -sf $(SO_LIBRARY) libpcscada.so && \
		ln -sf $(SO_LIBRARY) libpcscada.so.$(MAJOR)

apidoc:
	@echo "Creating API doc for version $(VERSION) ..."
	@mkdir -p $(DOCDIR)/api
	@ls $(SOURCEDIR)/*.ads > pcscada.specs
	@adabrowse -c adabrowse.cfg -p -t -i -I src/ -f@pcscada.specs \
		-o $(DOCDIR)/api/
	@rm pcscada.specs

doc:
	@$(MAKE) -C doc

dist: distclean
	@echo -n "Creating release tarball '$(PCSCADA)' ($(VERSION)) ... "
	@mkdir -p $(DISTDIR)
	@cp -R * $(DISTDIR)
	@tar -C $(TMPDIR) -cjf $(TARBALL) $(PCSCADA)
	@rm -rf $(DISTDIR)
	@echo "DONE"

.PHONY: apidoc dist doc itests utests