Update build scripts and makefile to follow better practices.

This commit is contained in:
Captain4LK 2020-08-04 09:41:18 +02:00
parent 3b57a5be21
commit 9dd7bfb7b9
8 changed files with 16 additions and 16 deletions

View File

@ -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.

View File

@ -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
```

View File

@ -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

View File

@ -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
```

View File

@ -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

View File

@ -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
```

View File

@ -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

View File

@ -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)