forked from jjn1056/TicTacToe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
64 lines (54 loc) · 2.21 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
52
53
54
55
56
57
58
59
60
61
62
63
#
# makefile for common devops / automation tasks
#
LOCALDIR := ~/local/
PERLVERSION := 5.20.3
PERLINSTALLTARGETDIR := $(LOCALDIR)perl-$(PERLVERSION)
PERLBUILDURL := https://raw.githubusercontent.com/tokuhirom/Perl-Build/master/perl-build
CPANMURL := http://cpanmin.us/
LOCALPERL := $(PERLINSTALLTARGETDIR)/bin/perl$(PERLVERSION)
LOCALEXEC := $(LOCALDIR)exec
RUNTESTS := --notest
help::
@echo ""
@echo "==> Setup and Dependency Management"
@echo "setup -- Install Perl to $(LOCALDIR) and bootstrap dependencies"
@echo "installdeps -- Install 'cpanfile' dependencys to $(LOCALDIR)"
@echo "installdevelop -- Install 'cpanfile --with-develop' dependencys to $(LOCALDIR)"
@echo "buildperl -- Install Perl to $(PERLINSTALLTARGETDIR)"
@echo "locallib -- Bootstrap a local-lib to $(LOCALDIR)"
@echo "buildexec -- Create $(LOCALDIR)/exec script"
@echo ""
@echo "==> Server Control"
@echo "server -- Start the application in the foreground process"
@echo ""
buildperl::
@echo "Installing Perl"
curl $(PERLBUILDURL) | perl - --jobs 9 $(RUNTESTS) --noman $(PERLVERSION) $(PERLINSTALLTARGETDIR)
#chmod 755 $(PERLINSTALLTARGETDIR)/bin/perl
locallib::
@echo "Bootstrapping local::lib"
curl -L $(CPANMURL) | perl - -l $(LOCALDIR) local::lib
eval $$(perl -I$(LOCALDIR)lib/perl5 -Mlocal::lib=--deactivate-all); \
curl -L $(CPANMURL) | $(LOCALPERL) - -L $(LOCALDIR) $(RUNTESTS) --reinstall \
local::lib \
App::cpanminus \
App::local::lib::helper
buildexec::
@echo "Creating exec program"
@echo '#!/usr/bin/env bash' > $(LOCALEXEC)
@echo 'eval $$(perl -I$(LOCALDIR)lib/perl5 -Mlocal::lib=--deactivate-all)' >> $(LOCALEXEC)
@echo 'source $(LOCALDIR)bin/localenv-bashrc' >> $(LOCALEXEC)
@echo 'PATH=$(LOCALDIR)bin:$(PERLINSTALLTARGETDIR)/bin:$$PATH' >> $(LOCALEXEC)
@echo 'export PATH' >> $(LOCALEXEC)
@echo 'exec "$$@"' >> $(LOCALEXEC)
@chmod 755 $(LOCALEXEC)
installdeps::
@echo "Installing application dependencies"
$(LOCALEXEC) cpanm -v $(RUNTESTS) --metacpan --installdeps .
installdevelop::
@echo "Installing application dependencies"
$(LOCALEXEC) cpanm -v $(RUNTESTS) --metacpan --with-develop --installdeps .
setup:: buildperl locallib buildexec installdevelop
server::
$(LOCALEXEC) perl -Ilib lib/TicTacToe/Server.pm