]> src.bluestatic.org Git - armadillo.git/blob - Makefile
Include the path in "outside of jail" errors.
[armadillo.git] / Makefile
1 # Armadillo File Manager
2 # Copyright (c) 2012, Robert Sesek <http://www.bluestatic.org>
3 #
4 # This program is free software: you can redistribute it and/or modify it under
5 # the terms of the GNU General Public License as published by the Free Software
6 # Foundation, either version 3 of the License, or any later version.
7
8 VERSION_MAJOR=0
9 VERSION_MINOR=9
10 VERSION_NAMESPACE=armadillo.Version
11 VERSION_FILE=frontend/version.js.proto
12 VERSION_SOURCE=$(basename $(VERSION_FILE))
13
14 FRONTEND_SOURCES=frontend/jquery-1.7.1.js \
15 frontend/utils.js \
16 $(VERSION_SOURCE) \
17 frontend/tv_renamer.js \
18 frontend/path_control.js \
19 frontend/actor.js \
20 frontend/file.js \
21 frontend/main.js
22 FRONTEND_BIN=frontend/armadillo.js
23
24 # Default target, used to produce the backend and uncompiled frontend.
25 all: backend version frontend ignore_fe_bin
26
27 # Creates the compiled frontend code.
28 release: backend version compiled ignore_fe_bin
29
30 # Performs a release build and stamps the actual version file.
31 dist: backend version copy_version_src compiled stamp ignore_fe_bin
32
33 # Compiles the backend server.
34 backend:
35 go build -v .
36
37 # Compiles the frontend code for development.
38 frontend: $(FRONTEND_BIN)
39
40 $(FRONTEND_BIN): $(FRONTEND_SOURCES)
41 echo $(foreach f,$^,"document.write('<script src="fe/$(notdir $f)"></script>');\n") > $(FRONTEND_BIN)
42
43 # Compiles the frontend code for release.
44 compiled: SOURCES_FLAGS=$(foreach f,$(FRONTEND_SOURCES),--js=$f)
45 compiled:
46 java -jar closure-compiler.jar \
47 $(SOURCES_FLAGS) \
48 --js_output_file=$(FRONTEND_BIN) \
49 --compilation_level=SIMPLE_OPTIMIZATIONS
50
51 .PHONY: $(VERSION_FILE)
52
53 # Builds the version file template.
54 version:
55 if [[ -f $(VERSION_FILE) ]]; then $(MAKE) $(VERSION_FILE); fi
56 $(VERSION_FILE):
57 which gitcrement
58 @echo "// This file is automatically generated." > $(VERSION_FILE)
59 @echo >> $(VERSION_FILE)
60 @echo "$$.namespace('$(VERSION_NAMESPACE)');" >> $(VERSION_FILE)
61 @echo >> $(VERSION_FILE)
62 echo "$(VERSION_NAMESPACE).MAJOR = $(VERSION_MAJOR);" >> $(VERSION_FILE)
63 echo "$(VERSION_NAMESPACE).MINOR = $(VERSION_MINOR);" >> $(VERSION_FILE)
64 echo "$(VERSION_NAMESPACE).BUILD = $(shell gitcrement next);" >> $(VERSION_FILE)
65 echo "$(VERSION_NAMESPACE).STAMP = $(shell date +%s);" >> $(VERSION_FILE)
66
67 # Copies the version template to the source.
68 copy_version_src:
69 cp $(VERSION_FILE) $(VERSION_SOURCE)
70
71 # Commits the version source and the frontend bin.
72 stamp:
73 git commit $(VERSION_SOURCE) $(FRONTEND_BIN) \
74 --author='Armadillo Build Script <armadillo@bluestatic.org>' \
75 -m 'Stamp version.js @ $(shell gitcrement current)'
76
77 # Marks the frontend binary as unmodified.
78 ignore_fe_bin: $(FRONTEND_BIN)
79 git update-index --assume-unchanged $(FRONTEND_BIN)