git.m455.casa

fa

clone url: git://git.m455.casa/fa


esperbuild/espersrc/fennel-0.7.0/Makefile

1 LUA ?= lua
2 LUA_VERSION ?= $(shell $(LUA) -e 'v=_VERSION:gsub("^Lua *","");print(v)')
3 PREFIX ?= /usr/local
4 BINDIR ?= $(PREFIX)/bin
5 LUADIR ?= $(PREFIX)/share/lua/$(LUA_VERSION)
6
7 SRC=src/fennel.fnl fennelview.fnl $(wildcard src/fennel/*.fnl)
8
9 build: fennel
10
11 test: fennel.lua fennel
12 $(LUA) test/init.lua
13
14 testall: export FNL_TESTALL = 1
15 testall: export FNL_TEST_OUTPUT ?= text
16 testall: fennel
17 @printf 'Testing lua 5.1:\n' ; lua5.1 test/init.lua
18 @printf "\nTesting lua 5.2:\n"; lua5.2 test/init.lua
19 @printf "\nTesting lua 5.3:\n"; lua5.3 test/init.lua
20 @printf "\nTesting lua 5.4:\n"; lua5.4 test/init.lua
21 @printf "\nTesting luajit:\n" ; luajit test/init.lua
22
23 count: ; cloc --force-lang=lisp $(SRC)
24
25 # Avoid chicken/egg situation using the old Lua launcher.
26 LAUNCHER=$(LUA) old/launcher.lua --add-fennel-path src/?.fnl --globals "_G,_ENV"
27
28 # Precompile fennel libraries
29 fennelview.lua: fennelview.fnl fennel.lua ; $(LAUNCHER) --compile $< > $@
30
31 # All-in-one pure-lua script:
32 fennel: src/launcher.fnl $(SRC) fennelview.lua
33 echo "#!/usr/bin/env $(LUA)" > $@
34 $(LAUNCHER) --no-metadata --require-as-include --compile $< >> $@
35 chmod 755 $@
36
37 fennel.lua: $(SRC)
38 $(LAUNCHER) --no-metadata --require-as-include --compile $< > $@
39
40 # Change these up to swap out the version of Lua or for other operating systems.
41 STATIC_LUA_LIB ?= /usr/lib/x86_64-linux-gnu/liblua5.3.a
42 LUA_INCLUDE_DIR ?= /usr/include/lua5.3
43
44 fennel-bin: src/launcher.fnl fennel
45 ./fennel --add-fennel-path src/?.fnl --no-compiler-sandbox --compile-binary \
46 $< $@ \ $(STATIC_LUA_LIB) $(LUA_INCLUDE_DIR)
47
48 # Cross-compile to Windows; very experimental:
49 fennel-bin.exe: src/launcher.fnl fennel lua-5.3.5/src/liblua-mingw.a
50 CC=i686-w64-mingw32-gcc fennel --compile-binary $< fennel-bin \
51 lua-5.3.5/src/liblua-mingw.a $(LUA_INCLUDE_DIR)
52
53 # Sadly git will not work; you have to get the tarball for a working makefile:
54 lua-5.3.5: ; curl https://www.lua.org/ftp/lua-5.3.5.tar.gz | tar xz
55
56 # install gcc-mingw-w64-i686
57 lua-5.3.5/src/liblua-mingw.a: lua-5.3.5
58 make -C lua-5.3.5 mingw CC=i686-w64-mingw32-gcc
59 mv lua-5.3.5/src/liblua.a $@
60
61 ci: testall count
62
63 clean:
64 rm -f fennel.lua fennel fennel-bin *_binary.c fennel-bin.exe luacov.*
65 make -C lua-5.3.5 clean || true # this dir might not exist
66
67 coverage: fennel
68 $(LUA) -lluacov test/init.lua
69 @echo "generated luacov.report.out"
70
71 install: fennel fennel.lua fennelview.lua
72 mkdir -p $(BINDIR) && \
73 cp fennel $(BINDIR)/
74 mkdir -p $(LUADIR) && \
75 for f in fennel.lua fennelview.lua; do cp $$f $(LUADIR)/; done
76
77 # Release-related tasks:
78
79 ARM_HOST=deck3
80
81 fennel-arm32:
82 ssh $(ARM_HOST) "cd src/fennel && git fetch && git checkout $(VERSION) && \
83 STATIC_LUA_LIB=/usr/lib/arm-linux-gnueabihf/liblua5.3.a make fennel-bin"
84 scp $(ARM_HOST):src/fennel/fennel-bin $@
85
86 fennel.tar.gz: README.md LICENSE fennel.1 fennel fennel.lua fennelview.lua \
87 Makefile fennelview.fnl $(SRC)
88 mkdir fennel-$(VERSION)
89 cp -r $^ fennel-$(VERSION)
90 tar czf $@ fennel-$(VERSION)
91
92 release: fennel fennel-bin fennel-bin.exe fennel-arm32 fennel.tar.gz
93 mkdir -p downloads/
94 mv fennel downloads/fennel-$(VERSION)
95 mv fennel-bin downloads/fennel-$(VERSION)-x86_64
96 mv fennel-bin.exe downloads/fennel-$(VERSION)-windows32.exe
97 mv fennel-arm32 downloads/fennel-$(VERSION)-arm32
98 mv fennel.tar.gz downloads/fennel-$(VERSION).tar.gz
99 gpg -ab downloads/fennel-$(VERSION)
100 gpg -ab downloads/fennel-$(VERSION)-x86_64
101 gpg -ab downloads/fennel-$(VERSION)-windows32.exe
102 gpg -ab downloads/fennel-$(VERSION)-arm32
103 gpg -ab downloads/fennel-$(VERSION).tar.gz
104 rsync -r downloads/* fenneler@fennel-lang.org:fennel-lang.org/downloads/
105
106 .PHONY: build test testall count ci clean coverage install release