File: makefile

package info (click to toggle)
libtemplates-parser 11.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,304 kB
  • ctags: 199
  • sloc: ada: 8,107; makefile: 327; sh: 26
file content (162 lines) | stat: -rw-r--r-- 5,094 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
############################################################################
#                              Ada Web Server                              #
#                                                                          #
#                         Copyright (C) 2003-2008                          #
#                                 AdaCore                                  #
#                                                                          #
#  This library is free software; you can redistribute it and/or modify    #
#  it under the terms of the GNU General Public License as published by    #
#  the Free Software Foundation; either version 2 of the License, or (at   #
#  your option) any later version.                                         #
#                                                                          #
#  This library 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       #
#  General Public License for more details.                                #
#                                                                          #
#  You should have received a copy of the GNU General Public License       #
#  along with this library; if not, write to the Free Software Foundation, #
#  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.          #
############################################################################

MODE	= RELEASE
MAJOR   = 11
MINOR   = 0
VERSION	= $(MAJOR).$(MINOR)
GNAT	= gnat

PRJ_BUILD    = Debug
TP_TASKING   = Standard_Tasking
TP_XMLADA    = Disabled
LIBRARY_TYPE = relocatable

TR             = $(shell if [ -f /usr/bin/tr ]; then echo /usr/bin/tr; \
			else echo tr; fi)
DR_BUILD       = $(shell echo $(PRJ_BUILD) | $(TR) "[[:upper:]]" "[[:lower:]]")
BDIR           = .build/$(DR_BUILD)/$(LIBRARY_TYPE)

INSTALL = $(dir $(shell which gnatls))..
I_BIN	= $(INSTALL)/bin
I_INC	= $(INSTALL)/include/templates_parser
I_LIB	= $(INSTALL)/lib/templates_parser/$(LIBRARY_TYPE)
I_GPR	= $(INSTALL)/lib/gnat
I_TGP	= $(INSTALL)/lib/gnat/templates_parser
I_DOC	= $(INSTALL)/share/doc/templates_parser

CP	= cp -p
MKDIR	= mkdir -p

ifeq (${OS}, Windows_NT)
EXEEXT	= .exe
SOEXT	= .dll
LN	= cp -p
else
ifeq ($(UNAME), Darwin)
SOEXT   = .dylib
else
ifeq ($(UNAME), HP-UX)
SOEXT	= .sl
else
SOEXT	= .so
endif
endif
EXEEXT	=
LN	= ln -s
endif

CONFGPR	= config/tp_config.gpr

ALL_OPTIONS = INCLUDES="$(INCLUDES)" LIBS="$(LIBS)" MODE="$(MODE)" \
		TP_XMLADA="$(TP_XMLADA)" GNAT="$(GNAT)" \
		PRJ_BUILD="$(PRJ_BUILD)" LIBRARY_TYPE="$(LIBRARY_TYPE)" \
		BDIR="$(BDIR)"

ifneq (,$(CPUS))
   PARALLEL=-j$(CPUS)
endif

all:
	echo ""
	echo "Targets:"
	echo ""
	echo "build     : build package"
	echo "install   : install package (default INSTALL="$(INSTALL)")"
	echo "test      : run a regression test"
	echo "doc       : build documentation"
	echo "distrib   : build tarball distribution"
	echo ""

force:

build: setup_config force tp_xmlada.gpr
	$(GNAT) make $(PARALLEL) -p -Ptemplates_parser -XSONAME=libtemplates_parser.so.$(MAJOR)
	$(GNAT) make $(PARALLEL) -p -Ptools/tools

test: build
	$(MAKE) -C regtests $(ALL_OPTIONS) test

doc:
	$(MAKE) -C docs $(ALL_OPTIONS) doc
	echo Templates_Parser Documentation built with success.

# If tp_xmlada.gpr does not exist, use the dummy one (no XML/Ada required)
tp_xmlada.gpr:
	cp config/tp_xmlada_dummy.gpr tp_xmlada.gpr

setup:
ifeq ($(TP_XMLADA), Installed)
	cp config/tp_xmlada_installed.gpr tp_xmlada.gpr
else
	cp config/tp_xmlada_dummy.gpr tp_xmlada.gpr
endif
	$(MKDIR) -p $(BDIR)/obj
	$(MKDIR) -p $(BDIR)/lib

setup_config:
	echo 'project TP_Config is' > $(CONFGPR)
	echo '   for Source_Dirs use ();' >> $(CONFGPR)
	echo '   Default_Library_Type := "$(LIBRARY_TYPE)";' >> $(CONFGPR)
	echo '   Tasking := "$(TP_TASKING)";' >> $(CONFGPR)
	echo 'end TP_Config;' >> $(CONFGPR)

install_dirs:
	$(MKDIR) -p $(I_BIN)
	$(MKDIR) -p $(I_INC)
	$(MKDIR) -p $(I_LIB)
	$(MKDIR) -p $(I_GPR)
	$(MKDIR) -p $(I_TGP)
	$(MKDIR) -p $(I_DOC)

install: install_dirs
	$(CP) src/*.ad* $(I_INC)
	$(CP) $(BDIR)/lib/* $(I_LIB)
	$(CP) $(BDIR)/bin/* $(I_BIN)
	$(CP) config/templates_parser.gpr $(I_GPR)
	$(CP) config/tp_shared.gpr $(I_TGP)
	$(CP) tp_xmlada.gpr $(I_TGP)
	$(CP) $(CONFGPR) $(I_TGP)
	$(CP) docs/templates_parser*html $(I_DOC)
	$(CP) docs/templates_parser*pdf $(I_DOC)
	$(CP) docs/templates_parser*info* $(I_DOC)
ifeq ($(TP_XMLADA), Installed)
	$(CP) xsrc/*.ad* $(I_INC)
endif
	$(RM) -f $(I_LIB)/../../libtemplates_parser$(SOEXT)
ifeq ($(LIBRARY_TYPE), relocatable)
	$(LN) $(I_LIB)/libtemplates_parser$(SOEXT) $(I_LIB)/../../
endif

clean:
	$(GNAT) clean -Ptemplates_parser
	$(GNAT) clean -Ptools/tools
	$(MAKE) -C docs clean $(ALL_OPTIONS)
	$(MAKE) -C regtests clean $(ALL_OPTIONS)
	$(RM) -fr .build

distrib:
	-rm templates_parser-?.?.tar*
	tar cf templates_parser-$(VERSION).tar src/templates_parser*ad[sb] \
		config tools docs xsrc/*.ad* tp_shared.gpr \
		makefile \
		templates_parser.gpr
	gzip -9 templates_parser-$(VERSION).tar