libsvp64: introduce Makefile sketch
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 6 Sep 2023 18:55:17 +0000 (21:55 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Wed, 6 Sep 2023 18:56:09 +0000 (21:56 +0300)
src/libsvp64/Makefile [new file with mode: 0644]

diff --git a/src/libsvp64/Makefile b/src/libsvp64/Makefile
new file mode 100644 (file)
index 0000000..8121b9f
--- /dev/null
@@ -0,0 +1,50 @@
+CC?=gcc
+AR?=ar
+CFLAGS?=-O3 -Werror -Wall -Wextra
+PYTHON?=python3
+
+
+GENS:=\
+       svp64-dis-gen.c \
+       svp64-opc-gen.c \
+
+SRCS:=$(GENS)
+
+OBJS:=\
+       svp64-dis-gen.o \
+       svp64-opc-gen.o \
+
+
+.SUFFIX: .so .a .o .c
+
+
+.PHONY: all
+all: build
+
+
+.PHONY: build
+build: libsvp64.so
+
+
+.PHONY: clean
+clean:
+       rm -f $(GENS)
+       rm -f $(OBJS)
+       rm -f libsvp64.so
+       rm -f libsvp64.a
+
+
+libsvp64.so: libsvp64.a
+       $(CC) -fPIC -shared -o $@ -L. -Wl,--whole-archive libsvp64.a -Wl,--no-whole-archive
+
+
+libsvp64.a: $(OBJS)
+       $(AR) rcs $@ $^
+
+
+ $(GENS): codegen.py
+       SILENCELOG=true $(PYTHON) codegen.py $@ > $@
+
+
+.c.o:
+       $(CC) $(CFLAGS) -fPIC -c $< -o $@