📦 Vulkan dev tests inside Linux/BSD written in C.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

218 lines
4.9 KiB

#compiler
CC = cc
CXX = c++
#locate directories
SRC_DIR = src/
BLD_DIR = builds/
#used libraries directories
GLFW_LIB_DIR = external/GLFW/
STB_LIB_DIR = external/STB/
CGLTF_LD_DIR = external/cgltf/
VMA_LIB_DIR = external/amd_vma/
#locate core directories
CORE_DIR = ${SRC_DIR}core/
CORE_MATH_DIR = ${CORE_DIR}core-math/
CORE_VK_DIR = ${CORE_DIR}core-vulkan/
CORE_MODULES_DIR = ${CORE_DIR}core-modules/
DUMMY_MESH_DIR = ${SRC_DIR}models/
## FREEBSD MAKEFILE PARAMETERS ##
#freebsd vk lib dir
VK_LIB_DIR = /usr/local/include/vulkan/
GL_LIB_PATH = /usr/local/include/
#locate external deps
EXT_DEPS = ${VK_LIB_DIR}vulkan.h ${GLFW_LIB_DIR}glfw3.h ${GL_LIB_PATH}GL/gl.h ${VMA_LIB_DIR}vk_mem_alloc.h
#include directories
INCS = -I${VK_LIB_DIR} -I${GLFW_LIB_DIR} -I${GL_LIB_PATH} -I${CORE_MODULES_DIR} -I${STB_LIB_DIR} -I${CORE_MATH_DIR} -I${CORE_VK_DIR} -I${SRC_DIR}shaders/ -I${DUMMY_MESH_DIR} -I${CGLTF_LD_DIR} -I${SRC_DIR}core/core-system/ -I${VMA_LIB_DIR}
## DEBIAN MAKEFILE PARAMETERS ##
#debian vk lib dir
#VK_LIB_DIR = /usr/include/vulkan/
#locate external deps
#EXT_DEPS = ${VK_LIB_DIR}vulkan.h ${GLFW_LIB_DIR}glfw3.h ${VMA_LIB_DIR}vk_mem_alloc.h
#include directories
#INCS = -I${VK_LIB_DIR} -I${GLFW_LIB_DIR} -I${CORE_MODULES_DIR} -I${STB_LIB_DIR} -I${CORE_MATH_DIR} -I${CORE_VK_DIR} -I${SRC_DIR}shaders/ -I${DUMMY_MESH_DIR} -I${CGLTF_LD_DIR} -I${SRC_DIR}core/core-system/ -I${VMA_LIB_DIR}
#locate source files
#add as much as you need after the first one
SRCS = ${wildcard src/*.c} \
${wildcard src/core/core-math/*.c} \
${wildcard src/core/core-vulkan/*.c} \
${wildcard src/core/core-modules/*.c} \
$(wildcard src/core/core-system/*.c) \
${wildcard src/models/*.c}
CXXSRC = ${CORE_VK_DIR}vk_mem_alloc.cpp
#produced objects
OBJS = ${SRCS:.c=.o} ${CORE_VK_DIR}vk_mem_alloc.o
#locate shaders TEMPORAL SOLUTION
SHADER_DEPS = ${SRC_DIR}haders/vShader.h ${SRC_DIR}shaders/fShader.h
#cflags | gcc/g++ in FreeBSD don't have -lasan implemented yet. Comment -fsanitize=address to avoid compile errors
CFLAGS = -c -g -Wall ${INCS} -fsanitize=address
#cxxflags
CXXFLAGS = -c -g -Wall -I${VMA_LIB_DIR} -I${CORE_VK_DIR} ${INCS} -D__STDC_LIMIT_MACROS
#ldflags | gcc/g++ in FreeBSD don't have -lasan implemented yet. Comment -fsanitize=address to avoid compile errors
LIBS = -lglfw -lvulkan -lm
LDFLAGS = -L/usr/local/lib/ -fsanitize=address
#exec path and name
O_NAME=${BLD_DIR}test
## build exec ##
all: output
output: ${OBJS}
#${CC} ${OBJS} ${LDFLAGS} ${LIBS} -o ${O_NAME}
${CXX} ${OBJS} ${LDFLAGS} ${LIBS} -o ${O_NAME}
## build amd vulkan memory allocator
vk_mem_alloc.o: vk_mem_alloc.cpp vk_mem_alloc.h
${CXX} ${CXXFLAGS} vk_mem_alloc.cpp
## build objects ##
main.o: main.c
${CC} ${CFLAGS} main.c
km_vulkan.o: km_vulkan.h ${EXT_DEPS} ${SHADER_DEPS}
${CC} ${CFLAGS} km_vulkan.c
#km_math.o: ${CORE_MODULES_DIR}km_math.c ${CORE_MODULES_DIR}km_math.h ${CORE_MATH_DEPS}
# ${CC} ${CFLAGS} ${CORE_MODULES_DIR}km_math.c
## build math modules ##
quaternion.o: quaternion.c quaternion.h
${CC} ${CFLAGS} quaternion.c
matrix4.o: matrix4.c matrix4.h
${CC} ${CFLAGS} matrix4.c
vector2.o: vector2.c vector2.h
${CC} ${CFLAGS} vector2.c
vector3.o: vector3.c vector3.h
${CC} ${CFLAGS} vector3.c
utils.o: utils.c utils.h
${CC} ${CFLAGS} utils.c
## build vulkan modules ##
vk_buffers.o: vk_buffers.h
${CC} ${CFLAGS} vk_buffers.c
vk_vertex_buffer.o: vk_vertex_buffer.h
${CC} ${CFLAGS} vk_vertex_buffer.c
vk_uniform_buffer.o: vk_uniform_buffer.h
${CC} ${CFLAGS} vk_uniform_buffer.c
vk_command_buffers.o: vk_command_buffers.h
${CC} ${CFLAGS} vk_command_buffers.c
vk_depth_buffer.o: vk_depth_buffer.h
${CC} ${CFLAGS} vk_depth_buffer.c
vk_frame_buffers.o: vk_frame_buffers.h
${CC} ${CFLAGS} vk_frame_buffers.c
vk_cleanup.o: vk_cleanup.h
${CC} ${CFLAGS} vk_cleanup.c
vk_descriptors.o: vk_descriptors.h
${CC} ${CFLAGS} vk_descriptors.c
vk_draw_frame.o: vk_draw_frame.h
${CC} ${CFLAGS} vk_draw_frame.c
vk_graphics_pipeline.o: vk_graphics_pipeline.h
${CC} ${CFLAGS} vk_graphics_pipeline.c
vk_image_views.o: vk_image_views.h
${CC} ${CFLAGS} vk_image_views.c
vk_instance.o: ${CORE_VK_DIR}vk_instance.h
${CC} ${CFLAGS} vk_instance.c
vk_logical_device.o: vk_logical_device.h
${CC} ${CFLAGS} vk_logical_device.c
vk_physical_device.o: vk_physical_device.h
${CC} ${CFLAGS} vk_physical_device.c
vk_render_pass.o: vk_render_pass.h
${CC} ${CFLAGS} vk_render_pass.c
vk_shader_module.o: vk_shader_module.h
${CC} ${CFLAGS} vk_shader_module.c
vk_swapchain.o: vk_swapchain.h
${CC} ${CFLAGS} vk_swapchain.c
vk_sync_objects.o: vk_sync_objects.h
${CC} ${CFLAGS} vk_sync_objects.c
vk_graphics.o: vk_graphics.h
${CC} ${CFLAGS} vk_graphics.c
## build camera module
km_camera.o: km_camera.h
${CC} ${CFLAGS} km_camera.c
## build system modules
logsys.o: logsys.h
${CC} ${CFLAGS} logsys.c
## build dummy mesh
vk_dummy_mesh.o: vk_dummy_mesh.h
${CC} ${CFLAGS} vk_dummy_mesh.c
## remove things ##
.PHONY: clean
clean:
rm ${OBJS} ${O_NAME}