File: Makelocal-YAPP-module

package info (click to toggle)
cod-tools 3.7.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 154,792 kB
  • sloc: perl: 57,588; sh: 36,842; ansic: 6,402; xml: 1,982; yacc: 1,117; makefile: 727; python: 166
file content (55 lines) | stat: -rw-r--r-- 2,055 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
#---*- Makefile -*-------------------------------------------------------------
#$Author: antanas $
#$Date: 2021-08-02 12:37:21 +0300 (Mon, 02 Aug 2021) $
#$Revision: 8849 $
#$URL: svn+ssh://www.crystallography.net/home/coder/svn-repositories/cod-tools/tags/v3.7.0/makefiles/Makelocal-YAPP-module $
#------------------------------------------------------------------------------
#*
#  Builds a Perl module from a Yapp grammar file.
#**

# The following variables should be predefined in the Makeconf file:
# ${PKG_LIB_DIR}
#                   Name of the local Perl library directory in which
#                   the assembled Perl module should be placed.
# ${PKG_PATH}
#                   Relative path inside the local Perl library directory
#                   in which the assembled Perl module should be placed.
#                   If not defined, the relative path is determined
#                   from the ${PKG_PREFIX} variable value.
# ${PKG_PREFIX}
#                   Prefix of the Perl package name. For example, if
#                   the desired package name is 'X::Y::Z', then the 
#                   'X::Y::' value should be passed. Please note, that
#                   the 'Z' portion of the package name is determined
#                   automatically and is equal to the name of the
#                   current working directory.

PKG_LIB_DIR ?= lib
PKG_PREFIX  ?=
PKG_PATH    ?= ${patsubst %/,%, ${subst ::,/,${PKG_PREFIX}}}

PKG_NAME := ${notdir $(shell pwd)}.pm
PM_FILE  := ${PKG_NAME:%.pm=${PKG_LIB_DIR}/${PKG_PATH}/%.pm}

VFILE = .version
VERSION := $(shell grep -v "^\#" ${VFILE})

.PRECIOUS: ${PM_FILE}
.PHONY: all build install cleanAll cleanAll-YAPP-module

all: build

build: ${PM_FILE}

${PKG_LIB_DIR}/${PKG_PATH}/%.pm: grammar.yp
	yapp -v -m ${PKG_PREFIX}$* -o - $< | sed 's/@VERSION@/${VERSION}/' > $@

install: ${PM_FILE}
	mkdir --parents ${PREFIX}/lib/perl5/${PKG_PATH}
	install --mode 644 $< ${PREFIX}/lib/perl5/${PKG_PATH}

cleanAll distclean: cleanAll-YAPP-module

cleanAll-YAPP-module:
	rm -f ${PM_FILE} *.output