aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-08-04 21:28:39 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-08-04 21:28:39 +0300
commitbf993be4a04bc7279f7d49ae18f185e1dca36479 (patch)
treeaa38bf9ea3c172a2847e818ff05599a15fe1c2cb
parent09f8df9f7e1166be48cdd6b1caba0f6771dd753e (diff)
downloadcopyjit-bf993be4a04bc7279f7d49ae18f185e1dca36479.tar.gz
copyjit-bf993be4a04bc7279f7d49ae18f185e1dca36479.zip
move main.c to examples
-rw-r--r--.gitignore2
-rw-r--r--Makefile17
-rw-r--r--examples/main.c (renamed from src/main.c)2
-rwxr-xr-xtests/checkbin1269672 -> 0 bytes
4 files changed, 15 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index d0dcd40..5cc42f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,5 +11,7 @@ lib/*.d
tests/*.d
build
copyjit
+libcopyjit.a
+examples/copyjit
!include/copyjit
!lib/gen/.gitkeep
diff --git a/Makefile b/Makefile
index 9a89746..7a207a7 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ INCLUDEFLAGS = -Iinclude
COMPILEFLAGS =
LINKFLAGS =
-all: copyjit
+all: libcopyjit.a
# default values
CROSS_COMPILE ?=
@@ -68,6 +68,7 @@ ARCH != uname -m
LINT = $(COMPILE) $(LINTFLAGS)
+EXAMPLE_OBJS != ./scripts/gen-deps --sources examples/main.c
TEST_OBJS != ./scripts/gen-deps --sources tests/check.c
OBJS != ./scripts/gen-deps --sources "$(SOURCES)"
OPS != ./scripts/gen-ops --ops "$(OP_SOURCES)"
@@ -98,11 +99,17 @@ docs:
check: tests/check
./tests/check
-tests/check: $(OBJS) $(TEST_OBJS)
- $(COMPILE) build/tests/check.o build/src/copyjit.o -o tests/check
+.PHONY: examples
+examples: examples/copyjit
-copyjit: $(OBJS)
- $(COMPILE) $(OBJS) -o $@
+examples/copyjit: libcopyjit.a $(EXAMPLE_OBJS)
+ $(COMPILE) $(EXAMPLE_OBJS) -o $@ -L. -lcopyjit
+
+tests/check: libcopyjit.a $(TEST_OBJS)
+ $(COMPILE) $(TEST_OBJS) -o $@ -L. -lcopyjit
+
+libcopyjit.a: $(OBJS)
+ $(AR) rcs $@ $(OBJS)
# todo: generate operations after cloning? a bit tricky to tell make to generate
# a bunch of files only when required, maybe have a configure stage?
diff --git a/src/main.c b/examples/main.c
index de287f6..94e372b 100644
--- a/src/main.c
+++ b/examples/main.c
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <stddef.h>
-#include "copyjit.h"
+#include "../src/copyjit.h"
int main()
{
diff --git a/tests/check b/tests/check
deleted file mode 100755
index a904b37..0000000
--- a/tests/check
+++ /dev/null
Binary files differ