summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2025-04-14 22:46:21 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2025-04-14 23:11:22 +0200
commit6938ae45af8c1ea8932aa7245b4f3adfcf3fb510 (patch)
tree13dc3b88fd55b0706bd9439d172579f9f81bbee1
parente7f69c8fbbbcbddde84933b2becd91e787d1ac63 (diff)
Add autotools build system
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
-rw-r--r--.gitignore15
-rw-r--r--Makefile30
-rw-r--r--Makefile.am11
-rw-r--r--README4
-rwxr-xr-xautogen.sh3
-rw-r--r--configure.ac28
6 files changed, 61 insertions, 30 deletions
diff --git a/.gitignore b/.gitignore
index 2785713..1aebed7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,18 @@
*.[od]
*.swp
+
sm
+
+Makefile.in
+aclocal.m4
+autom4te.cache
+compile
+config.guess
+config.h.in
+config.sub
+configure
+configure~
+depcomp
+install-sh
+missing
+
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 1f49002..0000000
--- a/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-SHELL := /bin/sh
-CC := c99
-CFLAGS := -g -Werror -Wall -pedantic
-SRCDIR := ./src
-SRCS := $(shell find . -name '*.c')
-OBJS := $(SRCS:.c=.o)
-DEPS := $(OBJS:.o=.d)
-TARGET := sm
-
-.POSIX:
-.PHONY: all clean
-
-all: $(TARGET)
-
-%.d: %.c
- @$(CC) -MM $(CPPFLAGS) $< > $@
-
-%.o: %.c %.d
- @$(CC) $(CFLAGS) -c -o $@ $<
- @printf 'CC\t%s\n' '$@'
-
--include $(DEPS)
-
-$(TARGET): $(OBJS)
- @$(CC) $(CFLAGS) $(OBJS) -o $@
- @printf 'CCLD\t%s\n' '$@'
-
-clean:
- $(RM) $(TARGET)
- $(RM) $(OBJS) $(DEPS)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..197edcc
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,11 @@
+bin_PROGRAMS = sm
+sm_SOURCES = ./src/stack.c \
+ ./src/string_view.c \
+ ./src/utils.c \
+ ./src/array.c \
+ ./src/main.c \
+ ./src/parser.c \
+ ./src/vm.c \
+ ./src/lexer.c
+
+dist_doc_DATA = README
diff --git a/README b/README
new file mode 100644
index 0000000..7a848cc
--- /dev/null
+++ b/README
@@ -0,0 +1,4 @@
+Stack Machine
+=============
+
+Simple stack machine based on whitespace instructions
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..3ca5cb3
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,3 @@
+#!/bin/env sh
+
+autoreconf --install
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..e8cd96f
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,28 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.72])
+AC_INIT([sm], [1.0], [johnny@johnnyrichard.com])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
+
+AC_CONFIG_HEADERS([config.h])
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdint.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_CHECK_HEADER_STDBOOL
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT