From 6938ae45af8c1ea8932aa7245b4f3adfcf3fb510 Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Mon, 14 Apr 2025 22:46:21 +0200 Subject: Add autotools build system Signed-off-by: Johnny Richard --- .gitignore | 15 +++++++++++++++ Makefile | 30 ------------------------------ Makefile.am | 11 +++++++++++ README | 4 ++++ autogen.sh | 3 +++ configure.ac | 28 ++++++++++++++++++++++++++++ 6 files changed, 61 insertions(+), 30 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 README create mode 100755 autogen.sh create mode 100644 configure.ac 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 -- cgit v1.2.3