forked from cms-sw/SCRAM
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
51 lines (44 loc) · 1.29 KB
/
Makefile
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
ifneq ($(strip $(MAKECMDGOALS)),clean)
ifeq ($(strip $(VERSION)),)
VERSION:=$(strip $(filter V%,$(notdir $(shell pwd))))
ifeq ($(strip $(VERSION)),)
$(error Missing VERSION)
endif
endif
ifeq ($(strip $(INSTALL_BASE)),)
$(error Missing INSTALL_BASE)
endif
ifeq ($(strip $(PREFIX)),)
$(error Missing PREFIX)
endif
$(info SCRAM version: $(VERSION))
$(info SCRAM install prefix: $(INSTALL_BASE))
$(info SCRAM install path: $(PREFIX))
endif
.PHONY: all doc install
all: src/main/scram.pl doc
src/main/scram.pl: bin/scram
@[ -e $@ ] || exit 0
@[ -d $(@D) ] || mkdir $(@D) &&\
cd $(@D) &&\
rm -f $(@F) && ln -s ../../bin/scram $(@F) &&\
echo ">> Generated $@"
bin/scram: bin/scram.in
@sed -e "s|@CMS_PATH@|$(INSTALL_BASE)|g;s|@SCRAM_VERSION@|$(VERSION)|g" $< > $@ &&\
chmod 755 $@ &&\
echo ">> Generated $@"
doc: $(subst docs/man/,docs/man/man1/,$(subst .in,,$(wildcard docs/man/*.in)))
docs/man/man1/%.1: docs/man/%.1.in
@echo ">> Generation man pages for '$*'" &&\
[ -d $(@D) ] || mkdir $(@D) &&\
nroff -man $< > $@
install: all
@for f in `ls -d * | grep -v Makefile | grep -v INSTALL.txt` ; do \
echo "Copying $$f -> $(PREFIX)/$$f" &&\
rm -rf $(PREFIX)/$$f &&\
cp -RP $$f $(PREFIX) ;\
done ;\
cd $(PREFIX) &&\
rm bin/*.in docs/man/*.in
clean:
rm -rf docs/man/man1 bin/scram src/main