File: template-set.make.in

package info (click to toggle)
prayer 1.3.5-dfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 6,576 kB
  • sloc: ansic: 43,161; makefile: 817; sh: 445; perl: 166
file content (67 lines) | stat: -rw-r--r-- 1,848 bytes parent folder | download | duplicates (5)
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
ifndef NAME
NAME := $(notdir $(CURDIR))
endif

CPPFLAGS = -I/usr/include/prayer
CFLAGS += -fPIC
LDFLAGS_TEMPLATELIB = -shared -fPIC \
	-Wl,--defsym=template_map=template_map_$(NAME) \
	-Wl,--defsym=template_map_count=template_map_$(NAME)_count

EXPAND  = $(LIB_PREFIX)/template_expand
COMPILE = $(LIB_PREFIX)/template_compile
MKINDEX = $(LIB_PREFIX)/build_index.pl
MKDEPS  = $(LIB_PREFIX)/makedeps.pl

SESSION_LIB    = $(NAME)$(SHLIBEXT)
FRONTEND_LIB   = $(NAME)_frontend$(SHLIBEXT)
TEMPLATE_LIBS ?= $(SESSION_LIB) $(FRONTEND_LIB)
TARGETS       ?= $(TEMPLATE_LIBS)

VARS=$(filter-out common.vars,$(wildcard *.vars))
HTML=$(VARS:.vars=.html)

all: $(TARGETS)

$(TEMPLATE_LIBS):
	$(CC) $(LDFLAGS) $(LDFLAGS_TEMPLATELIB) -o $@ $^

_template_index.c _template_index_frontend.c:
	$(MKINDEX) $(NAME) $(^F) > $@

%.c: %.t
	$(COMPILE) $(NAME) $@ $(basename $<)

install-sources:
	$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_DIR) \
	  -d $(DESTDIR)$(PREFIX)/templates/$(NAME)
	$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
	  *.t *.vars $(DESTDIR)$(PREFIX)/templates/$(NAME)

install-libs: $(TEMPLATE_LIBS)
	$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_DIR) \
	  -d $(DESTDIR)$(LIB_PREFIX)/templates
	$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
	  $(TEMPLATE_LIBS) $(DESTDIR)$(LIB_PREFIX)/templates/

clean:
	rm -f $(TARGETS) *.html *.o *.c
distclean: clean
	rm -f *.d

test: $(HTML)

%.html: %.t %.vars common.vars
	$(EXPAND) $@ $* common.vars $*.vars

%_frontend.d: FRONTEND_FLAG = --frontend
%_frontend.d: TEMPLATES = $(TEMPLATES_FRONTEND)
export VPATH
$(TEMPLATE_LIBS:$(SHLIBEXT)=.d):
	$(MKDEPS) $(FRONTEND_FLAG) $(NAME) $(TEMPLATES) > $@
	sed -ri 's/^(_template_index[^:]*)/\1 $@/' $@

include $(TEMPLATE_LIBS:$(SHLIBEXT)=.d)

.PHONY: all install-sources install-libs clean distclean test
.DELETE_ON_ERROR: