Add Makefile to fridge game

git-svn-id: svn://kolibrios.org@8164 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maxcodehack 2020-11-08 16:31:57 +00:00
parent 31a0fa2971
commit 6dee931fa9
3 changed files with 32 additions and 38 deletions

29
programs/games/fridge/Makefile Executable file
View File

@ -0,0 +1,29 @@
CC = kos32-gcc
LD = kos32-ld
CONTRIB_DIR:= $(abspath ../../../contrib)
SDK_DIR:= $(CONTRIB_DIR)/sdk
C_LAYER:= $(CONTRIB_DIR)/C_Layer
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base 0
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32
INCLUDES= -I $(SDK_DIR)/sources/newlib/libc/include -I $(C_LAYER)/INCLUDE
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
SOURCES = fridge.c \
$(NULL)
OBJECTS = $(patsubst %.c, %.o, $(SOURCES))
default: fridge.kex
fridge.kex: $(OBJECTS) Makefile
$(LD) $(LDFLAGS) $(LIBPATH) --subsystem native -o fridge.kex $(OBJECTS) $(C_LAYER)/OBJ/loadlibimg.obj -lgcc -lc.dll
objcopy fridge.kex -O binary
rm fridge.o
%.o : %.c Makefile $(SOURCES)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<

View File

@ -1,35 +0,0 @@
#!/bin/bash
app_name=fridge
dir_path=/usr/local/kos32
# 1 - static, 2 - dynamic.
compile_mode=2
# for app with gui (native, windows, posix).
# for app with cui (console).
subsys_arg='native'
gcc_keys="-m32 -march=native -mtune=generic -std=c99 -c -O2 -fomit-frame-pointer -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32"
ld_keys1="-static -nostdlib --subsystem $subsys_arg --image-base 0"
ld_keys2="-call_shared -nostdlib --subsystem $subsys_arg --image-base 0"
path_to_headers="$dir_path/sdk/sources/newlib/libc/include"
path_to_ldscript1="$dir_path/sdk/sources/newlib/static.lds"
path_to_ldscript2="$dir_path/sdk/sources/newlib/app-dynamic.lds"
path_to_libc="$dir_path/lib"
path_to_libgcc="$dir_path/sdk/lib"
kos32-gcc $gcc_keys -I $path_to_headers -o $app_name.o $app_name.c
case $compile_mode in
1) kos32-ld $ld_keys1 -T $path_to_ldscript1 -Map=$app_name.map -L $path_to_libgcc -L $path_to_libc -o $app_name.kex $app_name.o loadlibimg.o -lc -lgcc -lc ;;
2) kos32-ld $ld_keys2 -T $path_to_ldscript2 -Map=$app_name.map -L $path_to_libgcc -L $path_to_libc -o $app_name.kex $app_name.o loadlibimg.o -lgcc -lc.dll ;;
*) exit 1 ;;
esac
kos32-strip -s $app_name.kex -o $app_name.kex
kos32-objcopy $app_name.kex -O binary
rm $app_name.o
rm $app_name.map
sleep 100
exit 0

View File

@ -1,3 +1,3 @@
To compilation, you need to have kolibri_libimg.h from /contrib/C_Layer/INCLUDES int this folder
You need to have loadlibimg.o from /contrib/C_Layer/OBJ (rename loadlibimg.obj to loadlibimg.o) too in this folder
First say 'make' in /contrib/C_Layer/ASM
Second say 'make' here
You will find 'fridge.kex' here