Fix SDL Makefile to use dll linker script

git-svn-id: svn://kolibrios.org@6356 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
ashmew2 2016-03-19 06:44:57 +00:00
parent 5f7bdd499c
commit 33d91d9843
4 changed files with 76 additions and 28 deletions

View File

@ -1,13 +1,16 @@
LIBRARY = SDL
CC = kos32-gcc
AR = kos32-ar
LD = kos32-ld
STRIP = kos32-strip
SDK_DIR:= $(abspath ../../..)
endian_OBJS = endian/SDL_endian.o
file_OBJS = file/SDL_rwops.o
hermes_OBJS = hermes/mmxp2_32.obj hermes/mmx_main.obj hermes/x86p_16.obj \
hermes/x86p_32.obj hermes/x86_main.obj
hermes_OBJS = hermes/mmxp2_32.o hermes/mmx_main.o hermes/x86p_16.o \
hermes/x86p_32.o hermes/x86_main.o
thread_OBJS = thread/SDL_syscond.o thread/SDL_sysmutex.o thread/SDL_syssem.o \
thread/SDL_systhread.o thread/SDL_thread.o
timer_OBJS = timer/SDL_timer.o timer/dummy/SDL_systimer.o
@ -21,14 +24,12 @@ video_OBJS = video/SDL_blit_0.o video/SDL_blit_1.o video/SDL_blit_A.o \
video/SDL_video.o video/SDL_yuv.o video/SDL_yuv_mmx.o \
video/SDL_yuv_sw.o video/menuetos/SDL_menuetevents.o \
video/menuetos/SDL_menuetvideo.o
audio_OBJS = audio/SDL_kolibri_audio.o
#\
# audio/klbr_sdk/src/init.o audio/klbr_sdk/src/setbuf.o \
# audio/klbr_sdk/src/stopbuf.o audio/klbr_sdk/src/sndgetsize.o
audio_OBJS = ../../sound/src/init.obj ../../sound/src/setbuf.obj \
../../sound/src/stopbuf.obj ../../sound/src/sndgetsize.obj audio/SDL_kolibri_audio.o
curr_OBJS = SDL.o SDL_error.o SDL_fatal.o SDL_getenv.o
OBJS = $(endian_OBJS) $(file_OBJS) $(hermes_OBJS) $(thread_OBJS) \
OBJECTS = $(endian_OBJS) $(file_OBJS) $(hermes_OBJS) $(thread_OBJS) \
$(timer_OBJS) $(event_OBJS) $(video_OBJS) $(curr_OBJS) $(audio_OBJS)
CFLAGS = -c -O2 -D_REENTRANT -I../include -I. -DPACKAGE=\"SDL\" -DVERSION=\"1.2.2\" \
@ -37,31 +38,75 @@ CFLAGS = -c -O2 -D_REENTRANT -I../include -I. -DPACKAGE=\"SDL\" -DVERSION=\"1.2.
-DUSE_ASMBLIT -Ihermes -Iaudio -Ivideo -Ievents \
-Ijoystick -Icdrom -Ithread -Itimer -Iendian -Ifile -DENABLE_MENUETOS \
-DNO_SIGNAL_H -DDISABLE_STDIO -DNEED_SDL_GETENV -DENABLE_FILE -UDISABLE_FILE \
-D__MENUETOS__ -DDEBUG_VIDEO -UWIN32 -U_Win32 -U_WIN32 -U__MINGW32__ \
-I../../newlib/libc/include/
-D__MENUETOS__ -DDEBUG_VIDEO -UWIN32 -U_Win32 -U_WIN32 -U__MINGW32__
LDFLAGS = -shared -s -T../../newlib/libc/app.lds -nostdlib --image-base 0 -L/home/autobuild/tools/win32/mingw32/lib -lgcc /home/autobuild/tools/win32/lib/libz.a /home/autobuild/tools/win32/lib/libdll.a /home/autobuild/tools/win32/lib/libapp.a /home/autobuild/tools/win32/lib/libc.dll.a
LDFLAGS = -shared -s -nostdlib -T../../newlib/dll.lds --entry _DllStartup --image-base=0
# --image-base 0 -L/home/autobuild/tools/win32/mingw32/lib -lgcc /home/autobuild/tools/win32/lib/libz.a /home/autobuild/tools/win32/lib/libdll.a /home/autobuild/tools/win32/lib/libapp.a /home/autobuild/tools/win32/lib/libc.dll.a
LDFLAGS+= --out-implib lib$(LIBRARY).dll.a
ARFLAGS = crs
INCLUDES= -I../../newlib/libc/include -I./include -I./include/freetype/config
LIBPATH:= -L../../../lib -L/home/autobuild/tools/win32/mingw32/lib
LIBS:= -ldll -lc.dll -lgcc
#include $(MENUETDEV)/makefiles/Makefile_for_lib
all: libSDL.a
# all: libSDL.a
install: libSDL.a
mv -f libSDL.a $(SDK_DIR)/lib
# install: libSDL.a
# mv -f libSDL.a $(SDK_DIR)/lib
libSDL.a: $(OBJS)
$(AR) $(ARFLAGS) libSDL.a
# libSDL.a: $(OBJS)
# $(AR) $(ARFLAGS) libSDL.a
# ../../sound/src/init.o : ../../sound/src/init.asm Makefile
# fasm ../../sound/src/init.asm ../../sound/src/init.o
# ../../sound/src/setbuf.o : ../../sound/src/setbuf.asm Makefile
# fasm ../../sound/src/setbuf.asm ../../sound/src/setbuf.o
# ../../sound/src/stopbuf.o : ../../sound/src/stopbuf.asm
# fasm ../../sound/src/stopbuf.asm ../../sound/src/stopbuf.o
# ../../sound/src/sndgetsize.o : ../../sound/src/sndgetsize.asm
# fasm ../../sound/src/sndgetsize.asm ../../sound/src/sndgetsize.o
%.o : %.asm Makefile
nasm -f coff $< -o $@
%.obj : %.asm Makefile
nasm -f coff $< $
fasm $< $@
# %.o : %.c Makefile
# $(CC) $(CFLAGS) -o $@ $<
# clean:
# -rm -f */*.o
all:lib$(LIBRARY).a $(LIBRARY).dll
lib$(LIBRARY).a: $(OBJECTS) Makefile
$(AR) cvrs lib$(LIBRARY).a $(OBJECTS)
mv -f lib$(LIBRARY).a ../../../lib
$(LIBRARY).dll: $(OBJECTS) Makefile
$(warning "$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(OBJECTS) $(LIBS)")
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(OBJECTS) $(LIBS)
$(STRIP) $@
#sed -f ../newlib/cmd1.sed lib$(LIBRARY).def > mem
#sed -f ../newlib/cmd2.sed mem >$(LIBRARY).inc
mv -f $@ ../../../bin
mv -f lib$(LIBRARY).dll.a ../../../lib
%.o : %.c Makefile
$(CC) $(CFLAGS) -o $@ $<
clean:
-rm -f */*.o
$(CC) $(INCLUDES) $(CFLAGS) $(DEFINES) -o $@ $<
clean:
-rm -f */*/*.o

View File

@ -30,7 +30,7 @@ void SDL_printf_error(const char * fmt,...)
int pid;
va_list args;
va_start(args,fmt);
__libclog_vprintf(fmt,args);
printf(fmt,args);
exit(-1);
}

View File

@ -31,6 +31,7 @@ static char rcsid =
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <kos32sys.h>
#include "SDL_error.h"
#include "SDL_timer.h"
@ -88,7 +89,7 @@ Uint32 SDL_GetTicks (void)
void SDL_Delay (Uint32 ms)
{
__menuet__delay100(ms);
delay(ms * 100);
/* Uint32 start = SDL_GetTicks();
do
__asm__("int $0x40" :: "a"(68),"b"(1));

View File

@ -105,12 +105,14 @@ _DestroyBuffer@4: ;str:dword
section '.data' align 16 data readable writable
hSound dd 0
hrdwSound dd ?
public hSound
public hrdwSound
hSound dd ?
hrdwSound dd ?
public hSound as '_hSound'
public hSound as 'hSound'
public hrdwSound as 'hrdwSound'
public hrdwSound as '_hrdwSound'
szInfinity db 'INFINITY',0
szSound db 'SOUND',0