summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-07-30 11:36:22 +0800
committerJSDurand <mmemmew@gmail.com>2023-07-30 11:36:22 +0800
commit1833b3dd63df7505630f9e40cc845a9468e77137 (patch)
treef4f808dfbe0a9d27747075611bbb66ddf68b2a4b
parenta18887835bbb6d6c92c17bbf2d25f8825830a4d0 (diff)
Fix makefile's.
Fix the broken Makefiles.
-rw-r--r--Makefile.am7
-rw-r--r--configure.ac4
-rw-r--r--src/Makefile.am25
3 files changed, 22 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index 3336e91..1bfdcf4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1 @@
-SUBDIRS=graph nfa grammar graph_macro chain src
-
-.PHONY: rs
-
-rs:
- cargo build
+SUBDIRS=src
diff --git a/configure.ac b/configure.ac
index f26ea11..393f57e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,7 +11,7 @@ AM_INIT_AUTOMAKE([subdir-objects])
AM_SILENT_RULES([yes])
dnl AC_CONFIG_SUBDIRS([graph], [receme], [nfa], [repcore])
-dnl AC_CONFIG_SUBDIRS([graph])
+dnl AC_CONFIG_SUBDIRS([src])
AC_PATH_PROG([CARGO], [cargo], [notfound])
AS_IF([test "$CARGO" = "notfound"], [AC_MSG_ERROR([cargo is required])])
@@ -19,7 +19,7 @@ AS_IF([test "$CARGO" = "notfound"], [AC_MSG_ERROR([cargo is required])])
AC_PATH_PROG([RUSTC], [rustc], [notfound])
AS_IF([test "$RUSTC" = "notfound"], [AC_MSG_ERROR([rustc is required])])
-AC_CONFIG_FILES([Makefile src/Makefile graph/Makefile nfa/Makefile chain/Makefile grammar/Makefile graph_macro/Makefile])
+AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index 114b168..94399cb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,8 +2,21 @@ CC=gcc
CFLAGS=-g -O0
-rep.so: binding.c ../target/debug/librep.dylib helper.o big_endian.o
- $(CC) $(CFLAGS) $+ -shared -export-dynamic -o $@
+REPLIB=../target/debug/librep.dylib
+
+all: rep.so
+
+rs:
+ cargo build
+
+rep.so: binding.c rs $(REPLIB) helper.o big_endian.o
+ $(CC) $(CFLAGS) binding.c $(REPLIB) helper.o big_endian.o -shared -export-dynamic -o $@
+
+big_endian.o: big_endian.c big_endian.h
+ $(CC) $(CFLAGS) -c $< -o $@
+
+helper.o: helper.c helper.h big_endian.o
+ $(CC) $(CFLAGS) -c helper.c -o $@
test: test.c ../target/debug/librep.dylib helper.o big_endian.o
$(CC) $(CFLAGS) $+ -o $@
@@ -11,10 +24,10 @@ test: test.c ../target/debug/librep.dylib helper.o big_endian.o
.PHONY: clean rs windows
clean:
- rm *.o
-
-rs:
- cargo build
+ -rm -f *.o
+ -rm -f rep.so
+ -rm -f test
+ cargo clean
windows:
cargo build --target=x86_64-pc-windows-gnu