aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-06-24 20:48:32 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-06-24 22:10:50 +0300
commit422b6c976e28445d2a6e14586fa416b0f16c093f (patch)
treea6bf3364cec45ed0c5d48e346a76a98fe9d0094a /Makefile
downloadcopyjit-422b6c976e28445d2a6e14586fa416b0f16c093f.tar.gz
copyjit-422b6c976e28445d2a6e14586fa416b0f16c093f.zip
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile76
1 files changed, 76 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..213b4b9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,76 @@
+DO != echo -n > deps.mk
+
+DEBUGFLAGS != [ $(RELEASE) ] && echo "-flto=auto -O2 -DNODEBUG" || echo "-O0 -g -DDEBUG"
+CFLAGS = -Wall -Wextra
+DEPFLAGS = -MT $@ -MMD -MP -MF $@.d
+LINTFLAGS = -fsyntax-only
+INCLUDEFLAGS = -Iinclude
+COMPILEFLAGS =
+LINKFLAGS =
+
+all: copyjit
+
+# default values
+CROSS_COMPILE ?=
+
+# common programs
+CC = gcc
+OBJCOPY = objcopy
+
+SOURCES :=
+OP_SOURCES :=
+
+include ops/source.mk
+include src/source.mk
+
+COMPILE = $(CROSS_COMPILE)$(CC) $(DEBUGFLAGS)\
+ $(CFLAGS) $(DEPFLAGS) $(COMPILEFLAGS) $(INCLUDEFLAGS)
+
+OP_COMPILE = $(CROSS_COMPILE)$(CC) \
+ -Wall -Wextra -O3 \
+ -fno-schedule-insns -fno-schedule-insns2
+
+LINT = $(COMPILE) $(LINTFLAGS)
+
+OBJS != ./scripts/gen-deps --sources "$(SOURCES)"
+OPS != ./scripts/gen-ops "$(OP_SOURCES)"
+
+include deps.mk
+include lib/source.mk
+
+.PHONY: lint
+lint: $(OBJS:.o=.o.l)
+
+.PHONY: format
+format:
+ @find src ops lib -iname '*.[ch]' |\
+ xargs -n 10 -P 0 uncrustify -c uncrustify.conf --no-backup -F -
+
+.PHONY: license
+license:
+ @find . -iname '*.[ch]' |\
+ xargs -n 10 -P 0 ./scripts/license
+
+.PHONY: docs
+docs:
+ @./scripts/warn-undocumented
+ @doxygen docs/doxygen.conf
+
+.PHONY: check
+check: ek
+ ./tests/check.sh
+
+copyjit: $(OBJS)
+ $(COMPILE) $(OBJS) -o $@
+
+# could probably make this a bit prettier
+.PHONY: clean
+clean:
+ @$(RM) -r build copyjit lib/gen/* lib/*.o lib/*.bin lib/*.d lib/prune deps.mk
+
+.PHONY: clean_docs
+clean_docs:
+ @$(RM) -r docs/output
+
+.PHONY: clean_all
+clean_all: clean clean_docs