blob: f136822efb728897ef54ab58ce988a953d5bb71f (
plain)
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
|
# lali (Lali Another Lisp Implementation)
#
# Author: Daniel Cerqueira (dan.git@lispclub.com)
# Maintainer: Daniel Cerqueira (dan.git@lispclub.com)
# Version: 0.0
# Keywords: lali, lisp, implementation, interpreter, lisp1.5,
# computer programming language
# Homepage: https://gitlab.com/alexandre1985/lali
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Copyright (C) 2025 Daniel Cerqueira
#
# This file is part of lali.
#
# lali is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <https://www.gnu.org/licenses/>.
#
#
# lali software is based on tiny-lisp <https://github.com/matp/tiny-lisp/> version
# from 2016, written by Matthias Pirstitz, which is released to public domain
# under Unlicense <https://unlicense.org/>.
PROGRAM := lali
LIBOBJECTS := liblali.o
LIB := lib$(PROGRAM).a
OBJECTS := $(LIBOBJECTS) lali.o
HTML := README.html
ifeq ($(shell uname -s), Linux)
CPPFLAGS += -D_DEFAULT_SOURCE -D_BSD_SOURCE
endif
CFLAGS += -std=c11 -Wall -pedantic
PREFIX ?= /usr/local
.PHONY: native
native: CPPFLAGS += -DNDEBUG
native: CFLAGS += -march=native -O2
native: $(PROGRAM)
.PHONY: generic
generic: CPPFLAGS += -DNDEBUG
generic: CFLAGS += -mtune=generic -O2
generic: $(PROGRAM)
.PHONY: all
all: CPPFLAGS += -DNDEBUG
all: CFLAGS += -march=native -O2
all: $(PROGRAM) $(LIB) $(HTML)
.PHONY: debug
debug: CPPFLAGS += -DDEBUG
debug: CFLAGS += -g
debug: LDFLAGS += -g
debug: $(PROGRAM)
.PHONY: clean
clean:
$(RM) $(PROGRAM) $(OBJECTS) $(LIB) $(HTML)
.PHONY: lib
lib: $(LIB)
$(LIB): $(LIBOBJECTS)
$(AR) rc $@ $(LIBOBJECTS)
ranlib $@
$(PROGRAM): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
# $(CC) $(LDFLAGS) lali.o -L. -l$(PROGRAM) -o $@
%.o: %.c %.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
.PHONY: html
html: $(HTML)
%.html: %.md
md2html -f -o $@ $<
.PHONY: install
install: native
install -D -m 311 -t $(PREFIX)/bin $(PROGRAM)
|