changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / makefile

changeset 42: 36c0358a46be
parent: 21e3a05f8c27
child: 16e13f034efc
author: ellis <ellis@rwest.io>
date: Sun, 31 Dec 2023 00:21:40 -0500
permissions: -rw-r--r--
description: patience is key
1 ### infra/makefile --- The Compiler Company Infrastructure
2 
3 # this makefile is used to build all of our source code, package it,
4 # and ship it to various locations. It is for internal-use only.
5 
6 # If possible, use the packy (packy.compiler.company) to find and
7 # download a prepared bundle that suits your project needs.
8 
9 # You probably don't want to install all targets unless you have lots
10 # of time and a powerful machine, although it is possible. Instead,
11 # just run the targets for the components you are missing in your
12 # local environment (compatible compiler versions, shared libraries,
13 # etc)
14 
15 VERSION="0.1.0"
16 LINUX_VERSION:=$(shell uname -r | cut -d- -f1)
17 B:=build
18 D:=dist
19 SRC:=comp
20 HG_COMMIT:=$(shell hg id -i)
21 
22 # init:sbcl rust emacs rocksdb comp virt;
23 # dist/linux dist/rust dist/bundle
24 all:dist/cdn dist/comp dist/fasl dist/sbcl dist/rocksdb dist/emacs
25 clean:;rm -rf $(B) $(D)
26 $(B):;mkdir -pv $@/src
27 $(D):;mkdir -pv $@
28 
29 ### Linux
30 LINUX_TARGET:=linux-$(LINUX_VERSION)
31 linux:$(LINUX_TARGET) linux-config;
32  mv build/$< dist/$<
33 $(LINUX_TARGET):scripts/get-linux.sh;
34  mkdir -pv build/$@
35  gpg --export autosigner@ torvalds@ gregkh@ > build/$@/keyring.gpg
36  $< $(LINUX_VERSION) build build/$@/keyring.gpg
37  cd build && unxz $@.tar.xz && tar -xvf $@.tar $(LINUX_TARGET)
38 linux-config:$(LINUX_TARGET);
39  cd build/$< && make mrproper -j && zcat /proc/config.gz > .config && yes N | make localmodconfig
40 clean-linux::;rm -rf build/$(LINUX_TARGET)
41 
42 ### Emacs
43 EMACS_TARGET:=build/src/emacs
44 EMACS_DIST:=$(D)/src/emacs
45 $(EMACS_TARGET):scripts/get-emacs.sh $(B);
46  $<
47 emacs:$(EMACS_TARGET)
48 emacs-build:emacs scripts/build-emacs.sh;
49  cd $(EMACS_TARGET) && ./autogen.sh
50  scripts/build-emacs.sh $(EMACS_TARGET)
51 emacs-install:emacs-build;
52  cd $(EMACS_TARGET) && make install
53 
54 ### RocksDB
55 ROCKSDB_TARGET:=build/src/rocksdb
56 $(ROCKSDB_TARGET):scripts/get-rocksdb.sh $(B)
57  $<
58  cd $(ROCKSDB_TARGET) && \
59  make shared_lib DISABLE_JEMALLOC=1
60 rocksdb:$(ROCKSDB_TARGET)
61 
62 rocksdb-install:$(ROCKSDB_TARGET)
63  cd $< && cp -rf $(ROCKSDB_TARGET)/include/* /usr/local/include/ && \
64  cp -f $(ROCKSDB_TARGET)/librocksdb.{so,dylib}* /usr/local/include/
65 
66 ### SBCL
67 SBCL_TARGET:=build/src/sbcl
68 $(SBCL_TARGET):scripts/get-sbcl.sh $(B);
69  $<
70  cd $(SBCL_TARGET) && \
71  echo '"2.4.1+main"' > version.lisp-expr && \
72  sh make.sh \
73  --without-gencgc \
74  --with-mark-region-gc \
75  --with-sb-xref-for-internals \ #
76  --with-core-compression \
77  --dynamic-space-size=8Gb \
78  --fancy
79 sbcl:$(SBCL_TARGET)
80 sbcl-docs:sbcl;## REQUIRES TEXLIVE
81  cd $(SBCL_TARGET)/doc/manual && make
82 sbcl-install:sbcl;cd $(SBCL_TARGET) && ./install.sh
83 clean-sbcl:$(SBCL_TARGET);cd $(SBCL_TARGET) && ./clean.sh
84 build/quicklisp.lisp:;curl -o build/quicklisp.lisp -O https://beta.quicklisp.org/quicklisp.lisp
85 quicklisp-install:build/quicklisp.lisp
86  sbcl --script $< --eval '(quicklisp-quickstart:install)'
87 ### Rust
88 RUST_TARGET:=build/src/rust
89 $(RUST_TARGET):scripts/get-rust.sh $(B);$<
90 rust:$(RUST_TARGET)
91 rust-install-x:rust;
92  cargo install --path $(RUST_TARGET)/src/tools/x
93 rust-build:rust rust-install-x;
94  cd $(RUST_TARGET) && x build library
95 rust-doc:rust rust-install-x;
96  cd $(RUST_TARGET) && x doc
97 rust-build-full:rust-build;
98  cd $(RUST_TARGET) && x build --stage 2 compiler/rustc
99 rust-install:rust-build;
100  cd $(RUST_TARGET) && x install
101 
102 ### Tree-sitter Langs
103 TS_LANGS_TARGET:=build/src/ts-langs
104 ts-langs-install:scripts/ts-install-langs.sh
105  $<
106 ### Comp
107 COMP_TARGET:=build/src/$(SRC)
108 comp:scripts/get-comp.sh $(B)
109  $< $(SRC)
110 
111 clean-comp::;rm -rf $(COMP_TARGET)
112 
113 ### Virt
114 dev-pod:virt/build-pod.sh
115  $<
116 archlinux:virt/build-archlinux-base.sh
117  $<
118 fedora:virt/build-fedora-base.sh
119  $<
120 box:virt/build-box-base.sh
121  $<
122 bbdb:virt/build-bbdb-base.sh
123  $<
124 heptapod:virt/build-heptapod.sh
125  $<
126 heptapod-runner:virt/build-heptapod-runner.sh
127  $<
128 
129 vc-pod:heptapod heptapod-runner
130 
131 virt:pod box bbdb vc
132 
133 ### Dist
134 dist/bundle:scripts/bundle-dir.sh $(D)
135  $<
136 
137 dist/cdn:cdn $(D)
138  mkdir -pv $@
139  cp -r $</* $@
140 
141 dist/sbcl:sbcl $(D);
142  mkdir -pv $@
143  cp $(SBCL_TARGET)/src/runtime/sbcl $@
144  cp $(SBCL_TARGET)/output/sbcl.core $@
145  cp -r $(SBCL_TARGET)/contrib $@
146  cd $(SBCL_TARGET) && ./clean.sh
147  tar -I 'zstd' -cf $@/sbcl-source.tar.zst --exclude .git $(SBCL_TARGET)
148 
149 dist/linux:linux $(D);
150 
151 dist/rocksdb:rocksdb $(D);
152  mkdir -pv $@
153  cp -rf $(ROCKSDB_TARGET)/include/* $@
154  cp -f $(ROCKSDB_TARGET)/librocksdb.* $@
155 
156 dist/rust:rust-build $(D);
157  cd $(RUST_TARGET) && x dist
158 
159 dist/emacs:emacs-build $(D);
160 
161 dist/fasl:scripts/sbcl-save-core.sh quicklisp-install
162  mkdir -pv $@
163  $< "$@/std.core"
164  $< "$@/prelude.core" "(mapc #'ql:quickload \
165  (list :nlp :rdb :organ :packy :skel :obj :net :parse :pod :dat :log :packy :rt :syn :xdb))"
166 
167 dist/comp:comp
168  mkdir -pv $@
169  cp -r $(COMP_TARGET)/{org,core,infra,demo,nas-t} $@
170 clean-dist:;rm -rf $(D)
171 clean-build:;rm -rf $(B)
172 
173 ### Quickstart
174 quick:comp