|
| 1 | +# |
| 2 | +# GNUmakefile to build Practical Common Lisp Lispbox distro. |
| 3 | +# Copyright 2005 Peter Seibel. |
| 4 | +# |
| 5 | + |
| 6 | +# N.B. I know about the z flag to tar. However, on OS X gzip complains |
| 7 | +# about trailing garbage if not passed the -q flag. And tar doesn't |
| 8 | +# seem to pay attention to the GZIP environment variable. |
| 9 | + |
| 10 | +include GNUmakefile.vars |
| 11 | + |
| 12 | +LISPBOX_LISP := sbcl |
| 13 | +GNU_LINUX_EMACS_VERSION := 21.4 |
| 14 | +WINDOWS_EMACS_VERSION := 21.3 |
| 15 | +CLISP_VERSION := 2.41 |
| 16 | +ALLEGRO_VERSION := 70_trial |
| 17 | +SBCL_VERSION := 1.0.3 |
| 18 | +OPENMCL_VERSION := 1.0 |
| 19 | +SLIME_VERSION := 20070306.205402 |
| 20 | +PRACTICALS_VERSION := 1.0.3 |
| 21 | +PORTABLEASERVE_VERSION := 1.2.35 |
| 22 | + |
| 23 | +ifeq ($(os),Linux) |
| 24 | +emacs := emacs-$(GNU_LINUX_EMACS_VERSION) |
| 25 | +endif |
| 26 | +ifeq ($(os),Darwin) |
| 27 | +emacs := Emacs.app |
| 28 | +endif |
| 29 | +ifeq ($(os),Windows) |
| 30 | +emacs := emacs-$(WINDOWS_EMACS_VERSION) |
| 31 | +endif |
| 32 | + |
| 33 | +clisp := clisp-$(CLISP_VERSION) |
| 34 | +allegro := acl$(ALLEGRO_VERSION) |
| 35 | +sbcl := sbcl-$(SBCL_VERSION) |
| 36 | +openmcl := openmcl-$(OPENMCL_VERSION) |
| 37 | + |
| 38 | +lisp := $($(LISPBOX_LISP)) |
| 39 | +slime := slime-$(SLIME_VERSION) |
| 40 | +practicals := practicals-$(PRACTICALS_VERSION) |
| 41 | + |
| 42 | +ifeq ($(os),Darwin) |
| 43 | +lispbox_script_dir := $(prefix)/Emacs.app/Contents/MacOS |
| 44 | +emacs_site_lisp := $(prefix)/Emacs.app/Contents/Resources/site-lisp |
| 45 | +export LISPBOX_HOME_RELATIVE := /../../.. |
| 46 | +export EMACS_EXE := Emacs.app/Contents/MacOS/Emacs |
| 47 | +endif |
| 48 | +ifeq ($(os),Linux) |
| 49 | +lispbox_script_dir := $(prefix) |
| 50 | +emacs_site_lisp := $(prefix)/$(emacs)/share/emacs/site-lisp |
| 51 | +export LISPBOX_HOME_RELATIVE := |
| 52 | +export EMACS_EXE := $(emacs)/bin/emacs |
| 53 | +export LINUX=yes |
| 54 | +endif |
| 55 | +ifeq ($(os),Windows) |
| 56 | +lispbox_script_dir := $(prefix) |
| 57 | +emacs_site_lisp := $(prefix)/$(emacs)/site-lisp |
| 58 | +export LISPBOX_HOME_RELATIVE := |
| 59 | +export EMACS_EXE := $(emacs)/bin/runemacs.exe |
| 60 | +endif |
| 61 | + |
| 62 | +export EMACS := $(emacs) |
| 63 | + |
| 64 | +lispbox_elisp_dir := $(if $(NO_EMACS),$(prefix),$(emacs_site_lisp)) |
| 65 | + |
| 66 | +all: distro |
| 67 | + |
| 68 | +distros: |
| 69 | + $(MAKE) -f GNUmakefile.distros |
| 70 | + |
| 71 | +clean: |
| 72 | + rm -rf staging |
| 73 | + rm -rf $(prefix) |
| 74 | + |
| 75 | +source-dist: $(LISPBOX_HOME)-source.tar.gz |
| 76 | + |
| 77 | +$(LISPBOX_HOME)-source.tar.gz: |
| 78 | + mkdir $(prefix) |
| 79 | + mkdir -p $(prefix)/binary-archives |
| 80 | + cp binary-archives/$(practicals).tar.gz $(prefix)/binary-archives/ |
| 81 | + mkdir -p $(prefix)/source-archives |
| 82 | + mkdir -p $(prefix)/staging-archives |
| 83 | + cp asdf-extensions.lisp $(prefix) |
| 84 | + cp asdf.lisp $(prefix) |
| 85 | + cp COPYING $(prefix) |
| 86 | + cp ChangeLog $(prefix) |
| 87 | + cp GNUmakefile $(prefix) |
| 88 | + cp GNUmakefile.allegro $(prefix) |
| 89 | + cp GNUmakefile.base $(prefix) |
| 90 | + cp GNUmakefile.clisp $(prefix) |
| 91 | + cp GNUmakefile.emacs $(prefix) |
| 92 | + cp GNUmakefile.portableaserve $(prefix) |
| 93 | + cp GNUmakefile.practicals $(prefix) |
| 94 | + cp GNUmakefile.sbcl $(prefix) |
| 95 | + cp GNUmakefile.slime $(prefix) |
| 96 | + cp GNUmakefile.vars $(prefix) |
| 97 | + cp Info.plist $(prefix) |
| 98 | + cp OSXpackage.mk $(prefix) |
| 99 | + cp README $(prefix) |
| 100 | + cp README.source $(prefix) |
| 101 | + cp write-lispbox-el.sh $(prefix) |
| 102 | + cp write-lispbox.sh $(prefix) |
| 103 | + cp lispbox.bat $(prefix) |
| 104 | + cp write-site-init-lisp.sh $(prefix) |
| 105 | + (cd $(TOP); tar czf - $(LISPBOX_HOME)) > $@ |
| 106 | + |
| 107 | +$(prefix) staging: |
| 108 | + mkdir -p $@ |
| 109 | + |
| 110 | +staging/%: source-archives/%.tar.gz staging |
| 111 | + cat $< | (cd staging; gzip -cdq | tar xf -) |
| 112 | + find $@ -exec touch {} \; |
| 113 | + |
| 114 | +staging/%: source-archives/%.tar.bz2 staging |
| 115 | + cat $< | (cd staging; tar xjf -) |
| 116 | + find $@ -exec touch {} \; |
| 117 | + |
| 118 | +###################################################################### |
| 119 | +# Installer |
| 120 | + |
| 121 | +ifeq ($(os),Linux) |
| 122 | +distro_no_emacs := lispbox-$(LISPBOX_VERSION)-no-emacs-with-$(lisp).tar.gz |
| 123 | +distro_with_emacs := lispbox-$(LISPBOX_VERSION)-$(lisp).tar.gz |
| 124 | +distro_just_lisp := lispbox-$(LISPBOX_VERSION)-just-lisp-$(lisp).tar.gz |
| 125 | + |
| 126 | +distro := $(if $(JUST_LISP),$(distro_just_lisp),$(if $(NO_EMACS),$(distro_no_emacs),$(distro_with_emacs))) |
| 127 | + |
| 128 | +distro: $(distro) |
| 129 | + |
| 130 | +$(distro): lispbox |
| 131 | + (cd $(TOP); tar czf - $(LISPBOX_HOME)) > $@ |
| 132 | +endif |
| 133 | + |
| 134 | +ifeq ($(os),Darwin) |
| 135 | +distro_with_emacs := LispboxInstaller-$(LISPBOX_VERSION)-with-$(lisp).dmg |
| 136 | +distro_no_emacs := LispboxInstallerNoEmacs-$(LISPBOX_VERSION)-with-$(lisp).dmg |
| 137 | +distro_just_lisp := LispboxInstallerJustLisp-$(LISPBOX_VERSION)-$(lisp).dmg |
| 138 | + |
| 139 | +distro := $(if $(JUST_LISP),$(distro_just_lisp),$(if $(NO_EMACS),$(distro_no_emacs),$(distro_with_emacs))) |
| 140 | + |
| 141 | +distro: $(distro) |
| 142 | + |
| 143 | +$(distro): lispbox |
| 144 | + $(MAKE) -f OSXpackage.mk clean all NAME=$(distro) LISPBOX_VERSION=$(LISPBOX_VERSION) LISPBOX_LISP=$(lisp) |
| 145 | + |
| 146 | +endif |
| 147 | + |
| 148 | +ifeq ($(os),Windows) |
| 149 | +distro_no_emacs := lispbox-$(LISPBOX_VERSION)-no-emacs-with-$(lisp).zip |
| 150 | +distro_with_emacs := lispbox-$(LISPBOX_VERSION)-$(lisp).zip |
| 151 | +distro_just_lisp := lispbox-$(LISPBOX_VERSION)-just-lisp-$(lisp).zip |
| 152 | + |
| 153 | +distro := $(if $(JUST_LISP),$(distro_just_lisp),$(if $(NO_EMACS),$(distro_no_emacs),$(distro_with_emacs))) |
| 154 | + |
| 155 | +distro: $(distro) |
| 156 | + |
| 157 | +$(distro): lispbox |
| 158 | + (cd $(TOP); tar czf - $(LISPBOX_HOME)) > $@ |
| 159 | +endif |
| 160 | + |
| 161 | + |
| 162 | +###################################################################### |
| 163 | +# Lispbox |
| 164 | + |
| 165 | +lispbox: staging |
| 166 | + |
| 167 | +ifndef JUST_LISP |
| 168 | +ifndef NO_EMACS |
| 169 | +lispbox: $(emacs) |
| 170 | +ifeq ($(os),Windows) |
| 171 | +lispbox: $(lispbox_script_dir)/lispbox.bat |
| 172 | +endif |
| 173 | +ifneq ($(os),Windows) |
| 174 | +lispbox: $(lispbox_script_dir)/lispbox.sh |
| 175 | +endif |
| 176 | +ifeq ($(os),Darwin) |
| 177 | +lispbox: $(prefix)/Emacs.app/Contents/Info.plist |
| 178 | +endif # Darwin |
| 179 | +endif # not NO_EMACS |
| 180 | + |
| 181 | +lispbox: $(slime) |
| 182 | +lispbox: $(practicals) |
| 183 | +lispbox: $(prefix)/$(slime)/site-init.lisp |
| 184 | +lispbox: $(lispbox_elisp_dir)/lispbox.el |
| 185 | +lispbox: $(prefix)/asdf.lisp |
| 186 | +lispbox: $(prefix)/asdf-extensions.lisp |
| 187 | +ifneq ($(LISPBOX_LISP),allegro) |
| 188 | +portableaserve := portableaserve-$(PORTABLEASERVE_VERSION) |
| 189 | +lispbox: $(portableaserve) |
| 190 | +endif # not allegro |
| 191 | +endif # not JUST_LISP |
| 192 | + |
| 193 | +lispbox: $(lisp) |
| 194 | +lispbox: $(prefix)/$(lisp)/lispbox-register.el |
| 195 | + |
| 196 | +$(lispbox_script_dir)/lispbox.bat: lispbox.bat |
| 197 | + cp $< $@ |
| 198 | + |
| 199 | +$(lispbox_script_dir)/lispbox.sh: write-lispbox.sh $(prefix) |
| 200 | + SBCL_DIR=$(sbcl) OPENMCL_DIR=$(openmcl) $(SH) $< > $@ |
| 201 | + chmod +x $@ |
| 202 | + |
| 203 | +foo: $(lispbox_elisp_dir)/lispbox.el |
| 204 | + |
| 205 | +$(lispbox_elisp_dir)/lispbox.el: write-lispbox-el.sh $(if $(NO_EMACS),$(prefix),$(emacs)) |
| 206 | + SLIME_DIR=$(slime) SBCL_DIR=$(sbcl) OPENMCL_DIR=$(openmcl) $(SH) $< > $@ |
| 207 | + |
| 208 | +$(prefix)/$(slime)/site-init.lisp: write-site-init-lisp.sh $(prefix)/$(slime) |
| 209 | + PRACTICALS=$(practicals) PORTABLEASERVE=$(portableaserve) $(SH) $< > $@ |
| 210 | + chmod 0644 $@ |
| 211 | + |
| 212 | +$(prefix)/asdf.lisp: asdf.lisp |
| 213 | + cp $< $@ |
| 214 | + chmod 0644 $@ |
| 215 | + |
| 216 | +$(prefix)/asdf-extensions.lisp: asdf-extensions.lisp |
| 217 | + cp $< $@ |
| 218 | + chmod 0644 $@ |
| 219 | + |
| 220 | +$(prefix)/$(allegro)/lispbox-register.el: lisppath := (lispbox-list-to-filename (list (file-name-directory load-file-name) \"alisp\")) |
| 221 | +$(prefix)/$(allegro)/lispbox-register.el: license := \"devel.lic\" |
| 222 | + |
| 223 | +ifneq ($(os),Windows) |
| 224 | +$(prefix)/$(clisp)/lispbox-register.el: lisppath := (lispbox-list-to-filename (list (file-name-directory load-file-name) \"bin\" \"clisp\")) \"-ansi\" \"-K\" \"full\" \"-B\" (lispbox-list-to-filename (list (file-name-directory load-file-name) \"lib\" \"clisp\")) |
| 225 | +endif |
| 226 | + |
| 227 | +ifeq ($(os),Windows) |
| 228 | +$(prefix)/$(clisp)/lispbox-register.el: lisppath := \ |
| 229 | +(lispbox-list-to-filename (list (file-name-directory load-file-name) \"full\" \"lisp.exe\")) \"-ansi\" \ |
| 230 | +\"-M\" (lispbox-list-to-filename (list (file-name-directory load-file-name) \"full\" \"lispinit.mem\")) \ |
| 231 | +\"-B\" (lispbox-list-to-filename (list (file-name-directory load-file-name) \"full/\")) |
| 232 | +endif |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | +$(prefix)/$(sbcl)/lispbox-register.el: lisppath := (lispbox-list-to-filename (list (file-name-directory load-file-name) \"bin\" \"sbcl\")) |
| 237 | +$(prefix)/$(openmcl)/lispbox-register.el: lisppath := (lispbox-list-to-filename (list (file-name-directory load-file-name) \"scripts\" \"openmcl\")) |
| 238 | + |
| 239 | +$(prefix)/%/lispbox-register.el: $(lisp) |
| 240 | + echo "(push (list '$(lisp) (list $(lisppath))) slime-lisp-implementations)" > $@ |
| 241 | + if [ ! -z "$(license)" ]; \ |
| 242 | + then echo "(lispbox-install-lisp-license (list $(license)) \"$(*)\")" >> $@; \ |
| 243 | + fi |
| 244 | + |
| 245 | +ifeq ($(os),Darwin) |
| 246 | +$(prefix)/Emacs.app/Contents/Info.plist: Info.plist $(emacs) |
| 247 | + cp Info.plist $(prefix)/Emacs.app/Contents/ |
| 248 | +endif |
| 249 | + |
| 250 | +# Unpacking pre-built staging archives into prefix. |
| 251 | + |
| 252 | +components := $(emacs) $(allegro) $(clisp) $(sbcl) $(slime) $(practicals) $(portableaserve) |
| 253 | +ifeq ($(os),Darwin) |
| 254 | +components += $(openmcl) |
| 255 | +endif |
| 256 | + |
| 257 | + |
| 258 | +$(components): %: staging-archives/%.tar.gz $(prefix) |
| 259 | + cat $< | (cd $(prefix); gzip -cdq | tar xf -) |
| 260 | + |
| 261 | +$(sbcl): staging-archives/$(sbcl).tar.gz $(prefix) |
| 262 | + cat $< | (cd $(prefix); gzip -cdq | tar xf -) |
| 263 | + |
| 264 | +# Building staging archives if necessary |
| 265 | + |
| 266 | +staging-archives/$(emacs).tar.gz: makefile := GNUmakefile.emacs |
| 267 | +staging-archives/$(allegro).tar.gz: makefile := GNUmakefile.allegro |
| 268 | +staging-archives/$(clisp).tar.gz: makefile := GNUmakefile.clisp |
| 269 | +staging-archives/$(openmcl).tar.gz: makefile := GNUmakefile.openmcl |
| 270 | +staging-archives/$(sbcl).tar.gz: makefile := GNUmakefile.sbcl |
| 271 | +staging-archives/$(slime).tar.gz: makefile := GNUmakefile.slime |
| 272 | +staging-archives/$(practicals).tar.gz: makefile := GNUmakefile.practicals |
| 273 | +staging-archives/$(portableaserve).tar.gz: makefile := GNUmakefile.portableaserve |
| 274 | + |
| 275 | +staging-archives/%.tar.gz: |
| 276 | + $(MAKE) -f $(makefile) THING=$* |
| 277 | + |
| 278 | +### EMACS ### |
| 279 | + |
| 280 | +emacs: $(emacs) |
| 281 | + |
| 282 | +slime-docs: emacs |
| 283 | + cd $(prefix)/$(slime)/doc; \ |
| 284 | + $(MAKE) infodir=$(prefix)/$(emacs)/info install-info |
| 285 | + |
| 286 | + |
0 commit comments