CC = gcc CFLAGS = -O2 -Wall -Wextra -Winit-self LDFLAGS = -lSDL2 -lSDL2_image INCLUDEDIR = include HEADERS = headers BUILDDIR = build VERSION = 0.3.0 OBJS = ${BUILDDIR}/obj/lexsdl.o ${BUILDDIR}/obj/internal.o ${BUILDDIR}/obj/window.o ${BUILDDIR}/obj/renderer.o ${BUILDDIR}/obj/texture.o ${BUILDDIR}/obj/sprite.o ${BUILDDIR}/obj/event.o ${BUILDDIR}/obj/mouse.o ${BUILDDIR}/obj/timing.o LIB = ${BUILDDIR}/lib/liblexsdl.a CLIB = ${BUILDDIR}/c/liblexsdl.a RUSTLIB = target/release/liblexsdl.a dev: @echo "" @echo -e "\033[0;32mCompiling LEXSDL dev\033[0m" @cargo build @echo "" @echo -e "\033[0;92mBUILD SUCCESFULL!\033[0m" clib: ${OBJS} @echo "" @rm -rf ${BUILDDIR}/lib/ @mkdir -p ${BUILDDIR}/include/LEXSDL @mkdir -p ${BUILDDIR}/lib @mkdir -p ${BUILDDIR}/c @echo -e "\033[0;32mCopying LEXSDL headers\033[0m" @cp -r ${INCLUDEDIR}/* ${BUILDDIR}/include/LEXSDL/ @echo -e "\033[0;32mPacking liblexsdl.a\033[0m" @ar rcs ${CLIB} ${OBJS} @cp ${CLIB} ${BUILDDIR}/lib/ @echo "" @echo -e "\033[0;92mC BUILD SUCCESFULL!\033[0m" rustlib: @echo "" @rm -rf ${BUILDDIR}/lib/ @rm -rf ${BUILDDIR}/lib32/ @mkdir -p ${BUILDDIR}/lib @mkdir -p ${BUILDDIR}/lib32 @mkdir -p ${BUILDDIR}/include/LEXSDL @echo -e "\033[0;32mCopying LEXSDL headers\033[0m" @cp -r ${INCLUDEDIR}/* ${BUILDDIR}/include/LEXSDL/ @cp src/linux.sh ${BUILDDIR}/ @echo -e "\033[0;32mCompiling Rust LEXSDL\033[0m" @echo "" @cargo build --release @cargo build --release --target i686-unknown-linux-gnu @echo "" @cp ${RUSTLIB} ${BUILDDIR}/lib/ @cp target/i686-unknown-linux-gnu/release/liblexsdl.a ${BUILDDIR}/lib32/ @echo -e "\033[0;92mRUST BUILD SUCCESFULL!\033[0m" rustlibwin: @echo "" @rm -rf ${BUILDDIR}/lib/ @rm -rf ${BUILDDIR}/lib32/ @mkdir -p ${BUILDDIR}/lib @mkdir -p ${BUILDDIR}/lib32 @mkdir -p ${BUILDDIR}/include/LEXSDL @echo -e "\033[0;32mCopying LEXSDL headers\033[0m" @cp -r ${INCLUDEDIR}/* ${BUILDDIR}/include/LEXSDL/ @echo -e "\033[0;32mCompiling Rust LEXSDL WINDOWS\033[0m" @echo "" @cargo build --release --target x86_64-pc-windows-gnu @cargo build --release --target i686-pc-windows-gnu @echo "" @cp target/x86_64-pc-windows-gnu/release/liblexsdl.a ${BUILDDIR}/lib/ @cp target/x86_64-pc-windows-gnu/release/lexsdl.dll ${BUILDDIR}/lib/ @cp target/i686-pc-windows-gnu/release/liblexsdl.a ${BUILDDIR}/lib32/ @cp target/i686-pc-windows-gnu/release/lexsdl.dll ${BUILDDIR}/lib32/ @echo -e "\033[0;92mRUST WINDOWS BUILD SUCCESFULL!\033[0m" # examples testing: clib @echo -e "\033[0;32mBuilding Example Testing\033[0m" ${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} examples/testing.c ${LIB} -o ${BUILDDIR}/testing ${LDFLAGS} ${BUILDDIR}/testing complete: clib @echo -e "\033[0;32mBuilding Example Complete\033[0m" ${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} examples/complete.c ${LIB} -o ${BUILDDIR}/complete ${LDFLAGS} ${BUILDDIR}/complete integrating: clib @echo -e "\033[0;32mBuilding Example Integrating\033[0m" ${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} examples/integrating.c ${LIB} -o ${BUILDDIR}/integrating ${LDFLAGS} ${BUILDDIR}/integrating # objs ${BUILDDIR}/obj/lexsdl.o: src/lexsdl.c ${INCLUDEDIR}/LEXSDL.h headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling lexsdl.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/lexsdl.c -o ${BUILDDIR}/obj/lexsdl.o ${BUILDDIR}/obj/internal.o: src/internal.c headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling internal.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/internal.c -o ${BUILDDIR}/obj/internal.o ${BUILDDIR}/obj/window.o: src/window.c ${INCLUDEDIR}/LEXSDL_window.h headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling window.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/window.c -o ${BUILDDIR}/obj/window.o ${BUILDDIR}/obj/renderer.o: src/renderer.c ${INCLUDEDIR}/LEXSDL_renderer.h headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling renderer.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/renderer.c -o ${BUILDDIR}/obj/renderer.o ${BUILDDIR}/obj/texture.o: src/texture.c ${INCLUDEDIR}/LEXSDL_texture.h headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling texture.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/texture.c -o ${BUILDDIR}/obj/texture.o ${BUILDDIR}/obj/sprite.o: src/sprite.c ${INCLUDEDIR}/LEXSDL_sprite.h headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling sprite.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/sprite.c -o ${BUILDDIR}/obj/sprite.o ${BUILDDIR}/obj/event.o: src/event.c ${INCLUDEDIR}/LEXSDL_event.h headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling event.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/event.c -o ${BUILDDIR}/obj/event.o ${BUILDDIR}/obj/mouse.o: src/mouse.c ${INCLUDEDIR}/LEXSDL_mouse.h headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling mouse.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/mouse.c -o ${BUILDDIR}/obj/mouse.o ${BUILDDIR}/obj/timing.o: src/timing.c ${INCLUDEDIR}/LEXSDL_timing.h headers/LEXSDL_internal.h @echo -e "\033[0;32mCompiling timing.o\033[0m" @mkdir -p ${BUILDDIR}/obj @${CC} ${CFLAGS} -I${INCLUDEDIR} -I${HEADERS} -c src/timing.c -o ${BUILDDIR}/obj/timing.o # packing pack: rustlib @echo "" @echo -e "\033[0;32mPACKING LEXSDL\033[0m" @tar -czvf build/lexsdl-${VERSION}_linux.tar.gz -C build lib lib32 include linux.sh @echo "" @echo -e "\033[0;92mPACKED LEXSDL\033[0m" packwin: rustlibwin @echo "" @echo -e "\033[0;32mZIPPING LEXSDL WINDOWS\033[0m" @7z a -tzip build/lexsdl-${VERSION}_windows.zip ./build/lib ./build/lib32 ./build/include @echo "" @echo -e "\033[0;92mZIPPED LEXSDL WINDOWS\033[0m" packdoc: @echo "" @echo -e "\033[0;32mZIPPING LEXSDL DOCUMENTATION\033[0m" @7z a -tzip ${BUILDDIR}/lexsdl-${VERSION}_documentation.zip documentation @echo "" @echo -e "\033[0;92mZIPPED LEXSDL DOCUMENTATION\033[0m" packall: @make pack @make packwin @make packdoc #cleaning clean: @echo -e "\033[0;31mCleaning\033[0m" @rm -rf ${BUILDDIR} cleanall: @echo -e "\033[0;31mCleaning All\033[0m" @cargo clean