Files
my_device_handler/Makefile
2026-03-13 16:38:39 +01:00

80 lines
1.8 KiB
Makefile

include external.mk
include ${ARCH}_BUILD/variables.mk
GENERIC_TARGET_DEMO=main.exe #will create a demo for testing the functionalities implemented by the lib
GENERIC_TARGET_LIB=libmydevicehandler.so.0 #will create a shared lib
BUILD_DIR=${PWD_D}${ARCH}_BUILD
LIBRARY_OBJECTS=${BUILD_DIR}/my_device_handler.o ${BUILD_DIR}/registries.o ${BUILD_DIR}/registries_items.o ${BUILD_DIR}/events.o
OBJECTS=${BUILD_DIR}/main.o ${LIBRARY_OBJECTS}
all:
make ${GENERIC_TARGET_LIB}
make ${BUILD_DIR}/${GENERIC_TARGET_DEMO}
${GENERIC_TARGET_LIB} : ${LIBRARY_OBJECTS}
${COMPILER} \
-fPIC \
-shared \
-Wl,-soname,${GENERIC_TARGET_LIB} \
-o ${BUILD_DIR}/${GENERIC_TARGET_LIB} \
${L_EVDEV} \
${LIBRARY_OBJECTS} \
${LINK_LIBS}
${BUILD_DIR}/${GENERIC_TARGET_DEMO} : ${OBJECTS}
${COMPILER} \
-fPIC \
-o ${BUILD_DIR}/${GENERIC_TARGET_DEMO} \
${L_EVDEV} \
${OBJECTS} \
${LINK_LIBS}
# yup, -pthread needs to be used even in compilation
${BUILD_DIR}/main.o : main.c
${COMPILER} \
-fPIC \
-o ${BUILD_DIR}/main.o \
-c ${C_FLAGS} \
main.c
${BUILD_DIR}/my_device_handler.o : my_device_handler.c my_device_handler.h registries.h events.h
${COMPILER} \
-fPIC \
-o ${BUILD_DIR}/my_device_handler.o \
-c ${C_FLAGS} \
-pthread \
my_device_handler.c
${BUILD_DIR}/registries.o : registries.c registries.h registries_items.h
${COMPILER} \
-fPIC \
-o ${BUILD_DIR}/registries.o \
-c ${C_FLAGS} \
registries.c
${BUILD_DIR}/registries_items.o : registries_items.c registries_items.h threading.h
${COMPILER} \
-fPIC \
-o ${BUILD_DIR}/registries_items.o \
-c ${C_FLAGS} \
${I_EVDEV} \
-pthread \
registries_items.c
${BUILD_DIR}/events.o : events.c events.h
${COMPILER} \
-fPIC \
-o ${BUILD_DIR}/events.o \
-c ${C_FLAGS} \
events.c
.phony : clean
clean :
-rm ${OBJECTS} ${TARGET} ${GENERIC_TARGET_DEMO}