tmsim

A fast turing machine simulator with graphviz export functionality

git clone https://git.8pit.net/tmsim.git

 1# This is a POSIX Makefile as per IEEE P1003.1™-202x/D3.
 2.POSIX:
 3
 4VERSION = 1.0.0
 5PROGS   = tmsim tmsim-export
 6
 7SOURCES = scanner.c parser.c turing.c token.c queue.c util.c
 8OBJECTS = $(SOURCES:.c=.o)
 9HEADERS = $(SOURCES:.c=.h)
10
11CFLAGS ?= -O3 -g -Werror
12CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809L -DVERSION='"$(VERSION)"' \
13	-Wpedantic -Wall -Wextra -Wconversion -Wmissing-prototypes \
14	-Wpointer-arith -Wstrict-prototypes -Wshadow -Wcast-align
15
16CC      ?= gcc
17LDFLAGS += -pthread
18
19all: $(PROGS)
20$(OBJECTS): $(HEADERS)
21
22tmsim: $(OBJECTS) tmsim.o
23	$(CC) -o $@ $^ $(LDFLAGS)
24tmsim-export: $(OBJECTS) export.o
25	$(CC) -o $@ $^ $(LDFLAGS)
26
27test: tmsim
28	cd tests/ && ./run_tests.sh
29
30format:
31	clang-format -style=file -i $(SOURCES) $(HEADERS)
32
33clean:
34	$(RM) $(PROGS) $(OBJECTS) export.o tmsim.o
35
36.PHONY: all clean format test