From 9dd7bfb7b96d4f8ee9079f36c86023c82fa3f136 Mon Sep 17 00:00:00 2001 From: Captain4LK Date: Tue, 4 Aug 2020 09:41:18 +0200 Subject: [PATCH] Update build scripts and makefile to follow better practices. --- README.md | 7 ++++--- examples/efelder/README.md | 4 ++-- examples/efelder/build_linux.sh | 2 +- examples/performance/README.md | 4 ++-- examples/performance/build_linux.sh | 5 ++--- examples/resize/README.md | 4 ++-- examples/resize/build_linux.sh | 2 +- lib/makefile | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 2d1130c..1cf3130 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ SoftLK is free Software (as in freedom) and is released under the 3-clause BSD l 3. Clone this repository: `` git clone https://codeberg.org/Captain4LK/SoftLK-lib.git`` 4. Compile SoftLK: - You can either use the provided makefile: + You can either use the provided makefile (on freebsd please use gmake): ``` cd SoftLK-lib/lib @@ -37,7 +37,7 @@ SoftLK is free Software (as in freedom) and is released under the 3-clause BSD l ``` cd SoftLK-lib/lib gcc -O3 -c ../src/*.c ../src/backend/backend_sdl2_gl.c -lm -lSDL2 -lGL #Compile to object files first - ar cr libSLK.a *.o #Then link them together + ar crs libSLK.a *.o #Then link them together ``` 5. If everything went right you are now ready to start using SoftLK. Now you can either look at some of the examples, look at the [Getting started](https://codeberg.org/Captain4LK/SoftLK-lib/wiki/Getting-started) wikipage or figure things out yourself by looking at the source. @@ -47,7 +47,8 @@ SoftLK is free Software (as in freedom) and is released under the 3-clause BSD l SoftLK has been tested and is working on the following plattforms/os: -* Void GNU/Linux, amd64 (glibc/musl-libc) +* Void GNU/Linux, amd64 +* FreeBSD 12.1, amd64 SoftLK should work on any plattform that has a C compiler, SDL2 and OpenGL 2.1, the plattforms listed here are just the ones I frequently test SoftLK on. diff --git a/examples/efelder/README.md b/examples/efelder/README.md index ddc1385..a6f395b 100644 --- a/examples/efelder/README.md +++ b/examples/efelder/README.md @@ -10,10 +10,10 @@ In the program itself you can just press the information button (the one with an ## How to compile -If you are on linux and have gcc installed you can just use the provided shell script to compile this example, otherwise you can compile it like this (again, clang should work too): +If you are on linux (or FreeBSD, build_linux.sh works, too) and have gcc installed you can just use the provided shell script to compile this example, otherwise you can compile it like this (again, clang should work too): ``` -gcc -O3 -o resize *.c ../../lib/libSLK.a -lm -lSDL2 -lGL -Wall #Compile to executable +gcc -O3 -o resize *.c -L../../lib/ -lSLK -lm -lSDL2 -lGL -Wall #Compile to executable chmod +x ./resize #Only needed on unix(-like) systems ``` diff --git a/examples/efelder/build_linux.sh b/examples/efelder/build_linux.sh index c4f5d7a..6135da7 100755 --- a/examples/efelder/build_linux.sh +++ b/examples/efelder/build_linux.sh @@ -1,7 +1,7 @@ #!/bin/bash cd "$(dirname "$0")" -gcc -O3 -o efelder *.c ../../lib/libSLK.a -lm -lSDL2 -ldl -lGL -lcjson -Wall +gcc -O3 -o efelder *.c -L../../lib/ -lSLK -lm -lSDL2 -ldl -lGL -lcjson -Wall chmod +x efelder ./efelder exit diff --git a/examples/performance/README.md b/examples/performance/README.md index 063a0a8..1fcb09f 100644 --- a/examples/performance/README.md +++ b/examples/performance/README.md @@ -8,10 +8,10 @@ On the top left you can see to numbers. The number on the left displays the aver ## How to compile -If you are on linux and have gcc installed you can just use the provided shell script to compile this example, otherwise you can compile it like this (again, clang should work too): +If you are on linux and have gcc installed you can just use the provided shell script to compile this example (the build_linux.sh script also works for FreeBSD), otherwise you can compile it like this (again, clang should work too): ``` -gcc -O3 -o resize main.c ../../lib/libSLK.a -lm -lSDL2 -lGL -Wall #Compile to executable +gcc -O3 -o resize main.c -L../../lib/ -lSLK -lm -lSDL2 -lGL -Wall #Compile to executable chmod +x ./resize #Only needed on unix(-like) systems ``` diff --git a/examples/performance/build_linux.sh b/examples/performance/build_linux.sh index 772549c..bd9663f 100755 --- a/examples/performance/build_linux.sh +++ b/examples/performance/build_linux.sh @@ -1,9 +1,8 @@ -#!/bin/bash +#!/bin/sh cd "$(dirname "$0")" -gcc -O3 -o engine main.c ../../lib/libSLK.a -lm -lSDL2 -lGL -ldl -Wall +gcc -O3 -o engine main.c -L../../lib/ -lSLK -lm -lSDL2 -lGL -Wall chmod +x engine ./engine exit -/bin/bash diff --git a/examples/resize/README.md b/examples/resize/README.md index 09246ef..aa64692 100644 --- a/examples/resize/README.md +++ b/examples/resize/README.md @@ -6,11 +6,11 @@ Also, if you haven't noticed yet, the entire image is made of of just 256 colors ## How to compile -If you are on linux and have gcc installed you can just use the provided shell script to compile this example, otherwise you can compile it like this (again, clang should work too): +If you are on linux (or FreeBSD, build_linux.sh works, too) and have gcc installed you can just use the provided shell script to compile this example, otherwise you can compile it like this (again, clang should work too): ``` -gcc -O3 -o resize main.c ../../lib/libSLK.a -lm -lSDL2 -lGL -Wall #Compile to executable +gcc -O3 -o resize main.c -L../../lib/ -lSLK -lm -lSDL2 -lGL -Wall #Compile to executable chmod +x ./resize #Only needed on unix(-like) systems ``` diff --git a/examples/resize/build_linux.sh b/examples/resize/build_linux.sh index 3d2181e..0afd794 100755 --- a/examples/resize/build_linux.sh +++ b/examples/resize/build_linux.sh @@ -1,7 +1,7 @@ #!/bin/bash cd "$(dirname "$0")" -gcc -O3 -o engine main.c ../../lib/libSLK.a -lm -lSDL2 -lGL -Wall +gcc -O3 -o engine main.c -L../../lib/ -lSLK -lm -lSDL2 -lGL -Wall chmod +x engine ./engine exit diff --git a/lib/makefile b/lib/makefile index cc943da..8700305 100644 --- a/lib/makefile +++ b/lib/makefile @@ -1,12 +1,12 @@ CC = gcc -CFLAGS+=-lm -Wall +CFLAGS=-lm -Wall //CFLAGS+=-lm -Wall -pg DEPENDENCIES = SLK_core.o SLK_color.o SLK_draw_pal.o SLK_draw_rgb.o SLK_input.o SLK_layer.o SLK_palette.o SLK_sprite_pal.o SLK_sprite_rgb.o SLK_timer.o SLK_sheet_rgb.o SLK_sheet_pal.o .PHONY: backend_sdl2_gl backend_sdl2_gl: $(DEPENDENCIES) backend_sdl2_gl.o - ar cr libSLK.a $^ + ar crs libSLK.a $^ SLK_core.o: ../src/SLK_core.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/backend.h ../src/SLK_layer_i.h $(CC) -O3 -c $< $(CFLAGS)