From 3664670c89d7a7571208e857b50aeaa9c3629ea9 Mon Sep 17 00:00:00 2001 From: Konstantinos Margaritis Date: Tue, 11 Oct 2022 09:49:24 +0000 Subject: [PATCH] move pypowersim_wrapper on its own --- media/pypowersim_wrapper/Makefile | 21 +++++++++++++++++++ .../pypowersim_wrapper_common.h | 6 +++--- .../pypowersim_wrapper_example.c | 0 media/video/libvpx/Makefile | 11 +++------- 4 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 media/pypowersim_wrapper/Makefile rename media/{video/libvpx => pypowersim_wrapper}/pypowersim_wrapper_common.h (95%) rename media/{video/libvpx => pypowersim_wrapper}/pypowersim_wrapper_example.c (100%) diff --git a/media/pypowersim_wrapper/Makefile b/media/pypowersim_wrapper/Makefile new file mode 100644 index 00000000..7b604827 --- /dev/null +++ b/media/pypowersim_wrapper/Makefile @@ -0,0 +1,21 @@ +EXAMPLE=pypowersim_wrapper_example + +CC=gcc +CXX=g++ +AS=powerpc64le-linux-gnu-as +OBJCOPY=powerpc64le-linux-gnu-objcopy +CFLAGS= -Iinclude -O -g3 -I/usr/include/python3.7m +CXXFLAGS= -Iinclude -O -g3 +ASFLAGS= -mlibresoc -mregnames +LDFLAGS=-lgtest -pthread -lpython3.7m + +EXAMPLEC = pypowersim_wrapper_example.c +EXAMPLEOBJ = ${EXAMPLEC:.c=.o} + +${EXAMPLE}: ${EXAMPLEOBJ} + +all: ${EXAMPLE} + +.PHONY: clean +clean: + rm -f ${EXAMPLE} ${EXAMPLEOBJ} diff --git a/media/video/libvpx/pypowersim_wrapper_common.h b/media/pypowersim_wrapper/pypowersim_wrapper_common.h similarity index 95% rename from media/video/libvpx/pypowersim_wrapper_common.h rename to media/pypowersim_wrapper/pypowersim_wrapper_common.h index de358109..9a50d35a 100644 --- a/media/video/libvpx/pypowersim_wrapper_common.h +++ b/media/pypowersim_wrapper/pypowersim_wrapper_common.h @@ -25,7 +25,7 @@ typedef struct pypowersim_state { PyObject *result_obj; } pypowersim_state_t; -pypowersim_state_t *pypowersim_prepare(void) { +static pypowersim_state_t *pypowersim_prepare(void) { // Allocate memory for state pypowersim_state_t *state = malloc(sizeof(pypowersim_state_t)); if (!state) { @@ -95,7 +95,7 @@ pypowersim_state_t *pypowersim_prepare(void) { return state; } -void pypowersim_prepareargs(pypowersim_state_t *state) { +static void pypowersim_prepareargs(pypowersim_state_t *state) { // Set the tuple with the state objects state->args = PyTuple_Pack(12, state->binary, state->bigendian, state->prog, state->qemu_cosim, state->initial_regs, state->initial_sprs, state->svstate, state->mmu, @@ -108,7 +108,7 @@ void pypowersim_prepareargs(pypowersim_state_t *state) { } } -void pypowersim_finalize(pypowersim_state_t *state) { +static void pypowersim_finalize(pypowersim_state_t *state) { if (state->simulator) Py_DECREF(state->simulator); if (state->binary) Py_DECREF(state->binary); if (state->bigendian) Py_DECREF(state->bigendian); diff --git a/media/video/libvpx/pypowersim_wrapper_example.c b/media/pypowersim_wrapper/pypowersim_wrapper_example.c similarity index 100% rename from media/video/libvpx/pypowersim_wrapper_example.c rename to media/pypowersim_wrapper/pypowersim_wrapper_example.c diff --git a/media/video/libvpx/Makefile b/media/video/libvpx/Makefile index 9d16c33a..d035095d 100644 --- a/media/video/libvpx/Makefile +++ b/media/video/libvpx/Makefile @@ -1,12 +1,11 @@ VPXTARGET=libvpx_variance_test VP8TARGET=vp8_dct_test -EXAMPLE=pypowersim_wrapper_example CC=gcc CXX=g++ AS=powerpc64le-linux-gnu-as OBJCOPY=powerpc64le-linux-gnu-objcopy -CFLAGS= -Iinclude -O -g3 -I/usr/include/python3.7m +CFLAGS= -Iinclude -I../../pypowersim_wrapper -O -g3 -I/usr/include/python3.7m CXXFLAGS= -Iinclude -O -g3 ASFLAGS= -mlibresoc -mregnames LDFLAGS=-lgtest -pthread -lpython3.7m @@ -18,8 +17,6 @@ VP8_CFILES = vp8_dct4x4_ref.c vp8_dct4x4_wrappers.c VPX_CFILES = variance_ref.c variancefuncs_svp64.c variance_svp64_wrappers.c vpx_mem.c VP8_CPPFILES = test_libvpx.cc vp8_fdct4x4_test.cc VPX_CPPFILES = test_libvpx.cc variance_test.cc -EXAMPLEC = pypowersim_wrapper_example.c -EXAMPLEOBJ = ${EXAMPLEC:.c=.o} VP8_OBJFILES = $(VP8_ASFILES:.s=.o) $(VP8_CFILES:.c=.o) $(VP8_CPPFILES:.cc=.o) VPX_OBJFILES = $(VPX_ASFILES:.s=.o) $(VPX_CFILES:.c=.o) $(VPX_CPPFILES:.cc=.o) @@ -32,10 +29,8 @@ ${VP8TARGET}: ${VP8_OBJFILES} ${VPXTARGET}: ${VPX_OBJFILES} ${CXX} -o ${VPXTARGET} ${VPX_OBJFILES} ${LDFLAGS} -${EXAMPLE}: ${EXAMPLEOBJ} - -all: ${VP8TARGET} ${VPXTARGET} ${EXAMPLE} ${BINFILES} +all: ${VP8TARGET} ${VPXTARGET} ${BINFILES} .PHONY: clean clean: - rm -f ${VP8TARGET} ${VPXTARGET} ${VP8_OBJFILES} ${VPX_OBJFILES} ${BINFILES} ${EXAMPLE} ${EXAMPLEOBJ} + rm -f ${VP8TARGET} ${VPXTARGET} ${VP8_OBJFILES} ${VPX_OBJFILES} ${BINFILES} -- 2.30.2