summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2025-04-11 01:15:01 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2025-04-14 23:11:22 +0200
commite7f69c8fbbbcbddde84933b2becd91e787d1ac63 (patch)
tree16cd17da17133494dd06aab614724e76b059d4ad /Makefile
Intial commit
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1f49002
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+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)