summaryrefslogtreecommitdiff
path: root/work-in-progress/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'work-in-progress/Makefile')
-rw-r--r--work-in-progress/Makefile94
1 files changed, 94 insertions, 0 deletions
diff --git a/work-in-progress/Makefile b/work-in-progress/Makefile
new file mode 100644
index 0000000..f136822
--- /dev/null
+++ b/work-in-progress/Makefile
@@ -0,0 +1,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)