forked from atlas-engineer/nyxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
181 lines (153 loc) · 5.32 KB
/
Makefile
File metadata and controls
181 lines (153 loc) · 5.32 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
## Use Bourne shell syntax.
SHELL = /bin/sh
UNAME := $(shell uname)
LISP ?= sbcl
## We use --non-interactive with SBCL so that errors don't interrupt the CI.
LISP_FLAGS ?= --no-userinit --non-interactive
QUICKLISP_DIR=quicklisp-client
QUICKLISP_LIBRARIES=quicklisp-libraries
NYXT_INTERNAL_QUICKLISP = true
NYXT_RENDERER = gtk
PREFIX = /usr/local
prefix = $(PREFIX)
BINDIR = $(PREFIX)/bin
DATADIR = $(PREFIX)/share
APPLICATIONSDIR = /Applications
.PHONY: help
help:
@cat INSTALL
lisp_files := nyxt.asd $(shell find . -type f -name '*.lisp')
quicklisp_set_dir=(push \#p"$(QUICKLISP_LIBRARIES)/" (symbol-value (find-symbol "*LOCAL-PROJECT-DIRECTORIES*" (find-package (quote ql)))))
quicklisp_maybe_load=(when (string= (uiop:getenv "NYXT_INTERNAL_QUICKLISP") "true") (load "$(QUICKLISP_DIR)/setup.lisp") $(quicklisp_set_dir))
.PHONY: clean-fasls
clean-fasls:
$(NYXT_INTERNAL_QUICKLISP) && \
$(LISP) $(LISP_FLAGS) \
--eval '(require "asdf")' \
--load $(QUICKLISP_DIR)/setup.lisp \
--load nyxt.asd \
--eval '(ql:quickload :swank)' \
--eval '(load (merge-pathnames "contrib/swank-asdf.lisp" swank-loader:*source-directory*))' \
--eval '(swank:delete-system-fasls "nyxt")' \
--eval '(uiop:quit)' || true
nyxt: $(lisp_files)
$(MAKE) application
.PHONE: application
application: deps
env NYXT_INTERNAL_QUICKLISP=$(NYXT_INTERNAL_QUICKLISP) $(LISP) $(LISP_FLAGS) \
--eval '(require "asdf")' \
--eval '$(quicklisp_maybe_load)' \
--load nyxt.asd \
--eval '(asdf:make :nyxt/$(NYXT_RENDERER)-application)' \
--eval '(uiop:quit)' || (printf "\n%s\n%s\n" "Compilation failed, see the above stacktrace." && exit 1)
.PHONY: app-bundle
app-bundle:
mkdir -p ./Nyxt.app/Contents/MacOS
mkdir -p ./Nyxt.app/Contents/Resources
mv ./nyxt ./Nyxt.app/Contents/MacOS
cp ./assets/Info.plist ./Nyxt.app/Contents
cp ./assets/nyxt.icns ./Nyxt.app/Contents/Resources
.PHONY: install-app-bundle
install-app-bundle:
cp -r Nyxt.app $(DESTDIR)/Applications
.PHONY: all
all: nyxt
ifeq ($(UNAME), Darwin)
all: nyxt app-bundle
endif
## We use a temporary "version" file to generate the final nyxt.desktop with the
## right version number. Since "version" is a file target, third-party
## packaging systems can choose to generate "version" in advance before calling
## "make install-assets", so that they won't need to rely on Quicklisp.
version: deps
env NYXT_INTERNAL_QUICKLISP=$(NYXT_INTERNAL_QUICKLISP) $(LISP) $(LISP_FLAGS) \
--eval '(require "asdf")' \
--eval '$(quicklisp_maybe_load)' \
--load nyxt.asd \
--eval '(asdf:load-system :nyxt)' \
--eval '(with-open-file (stream "version" :direction :output :if-exists :supersede) (format stream "~a" nyxt:+version+))' \
--eval '(uiop:quit)'
.PHONY: install-assets
install-assets: version
mkdir -p "$(DESTDIR)$(DATADIR)/applications/"
sed "s/VERSION/$$(cat version)/" assets/nyxt.desktop > "$(DESTDIR)$(DATADIR)/applications/nyxt.desktop"
rm version
for i in 16 32 128 256 512; do \
mkdir -p "$(DESTDIR)$(DATADIR)/icons/hicolor/$${i}x$${i}/apps/" ; \
cp -f assets/nyxt_$${i}x$${i}.png "$(DESTDIR)$(DATADIR)/icons/hicolor/$${i}x$${i}/apps/nyxt.png" ; \
done
.PHONY: install-nyxt
install-nyxt: nyxt
mkdir -p "$(DESTDIR)$(BINDIR)"
cp -f $< "$(DESTDIR)$(BINDIR)/"
chmod 755 "$(DESTDIR)$(BINDIR)/"$<
.PHONY: install
install:
install:
ifeq ($(UNAME), Linux)
install: install-nyxt install-assets
endif
ifeq ($(UNAME), Darwin)
install: install-app-bundle
endif
.PHONY: quicklisp-extra-libs
quicklisp-extra-libs:
$(NYXT_INTERNAL_QUICKLISP) && git submodule update --init || true
## This rule only updates the internal distribution.
.PHONY: quicklisp-update
quicklisp-update:
$(NYXT_INTERNAL_QUICKLISP) && $(LISP) $(LISP_FLAGS) \
--load $(QUICKLISP_DIR)/setup.lisp \
--eval '(require "asdf")' \
--eval '(ql:update-dist "quicklisp" :prompt nil)' \
--eval '(uiop:quit)' || true
.PHONY: build-deps
build-deps: quicklisp-extra-libs
$(LISP) $(LISP_FLAGS) \
--eval '(require "asdf")' \
--load $(QUICKLISP_DIR)/setup.lisp \
--eval '$(quicklisp_set_dir)' \
--load nyxt.asd \
--eval '(ql:quickload :nyxt/$(NYXT_RENDERER)-application)' \
--eval '(uiop:quit)' || true
$(MAKE) quicklisp-update
.PHONY: deps
deps:
$(NYXT_INTERNAL_QUICKLISP) && $(MAKE) build-deps || true
manual.html: $(lisp_files)
env NYXT_INTERNAL_QUICKLISP=$(NYXT_INTERNAL_QUICKLISP) $(LISP) $(LISP_FLAGS) \
--eval '(require "asdf")' \
--eval '$(quicklisp_maybe_load)' \
--load nyxt.asd \
--eval '(asdf:load-system :nyxt)' \
--eval '(with-open-file (out "manual.html" :direction :output) (write-string (nyxt::manual-content) out))' \
--eval '(uiop:quit)'
.PHONY: doc
doc: manual.html
.PHONY: check
check: check-asdf check-binary
## TODO: Test that Nyxt starts even with broken init file.
.PHONY: check-build
check-build: deps
env NYXT_INTERNAL_QUICKLISP=$(NYXT_INTERNAL_QUICKLISP) $(LISP) $(LISP_FLAGS) \
--eval '(require "asdf")' \
--eval '$(quicklisp_maybe_load)' \
--load nyxt.asd \
--eval '(ql:quickload :nyxt)' \
--eval '(uiop:quit)'
.PHONY: check-asdf
check-asdf: deps
env NYXT_INTERNAL_QUICKLISP=$(NYXT_INTERNAL_QUICKLISP) $(LISP) $(LISP_FLAGS) \
--eval '(require "asdf")' \
--eval '$(quicklisp_maybe_load)' \
--load nyxt.asd \
--eval '(asdf:test-system :nyxt)' \
--eval '(uiop:quit)'
.PHONY: check-binary
check-binary: nyxt
./nyxt -h
.PHONY: clean-deps
clean-deps:
rm -rf $(QUICKLISP_DIR)
.PHONY: clean
clean: clean-fasls clean-deps