forked from libsdl-org/SDL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.mos
126 lines (106 loc) · 4.22 KB
/
Makefile.mos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Makefile to build the SDL2 library MORPHOS
#
# You need tinygl.library 53.7 and last SDK with last tinyGL SDK
#
# Enable debug with -D__SDL_DEBUG
#
CDEFS = -DAROS_ALMOST_COMPATIBLE -DBUILD_SDL2_LIBRARY -D__SDL_DEBUG
CC = ppc-morphos-gcc-9 -noixemul
AMIGADATE = $(shell date +"%-d.%-m.%Y")
INCLUDE = -I./include -D__AMIGADATE__=\"$(AMIGADATE)\"
CFLAGS = -mcpu=750 -mtune=7450 -O2 $(INCLUDE) -mresident32 -Wall -Wno-pointer-sign -fno-strict-aliasing $(CDEFS)
AR = ppc-morphos-ar
ECHE = echo -e
BOLD = \033[1m
NRML = \033[22m
COMPILING = @$(ECHE) "compiling $(BOLD)$@$(NRML)..."
LINKING = @$(ECHE) "linking $(BOLD)$@$(NRML)..."
STRIPPING = @$(ECHE) "stripping $(BOLD)$@$(NRML)..."
ARCHIVING = @$(ECHE) "archiving $(BOLD)$@$(NRML)..."
HEADERING = @$(ECHE) "creating headers files $(BOLD)$@$(NRML)..."
TARGET = libSDL2.a
LIBRARY = sdl2.library
SOURCES = \
src/*.c \
src/atomic/*.c \
src/audio/*.c \
src/audio/ahi/*.c \
src/cpuinfo/*.c \
src/events/*.c \
src/file/*.c \
src/filesystem/morphos/*.c \
src/joystick/*.c \
src/joystick/morphos/*.c \
src/power/*.c \
src/power/morphos/*.c \
src/render/*.c \
src/render/software/*.c \
src/render/opengl/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/thread/morphos/*.c \
src/thread/generic/SDL_syscond.c \
src/thread/generic/SDL_systls.c \
src/timer/*.c \
src/timer/morphos/*.c \
src/video/*.c \
src/video/dummy/*.c \
src/video/morphos/*.c \
src/video/yuv2rgb/*.c \
src/misc/*.c \
src/misc/morphos/*.c \
src/locale/*.c \
src/locale/morphos/*.c \
src/haptic/*.c \
src/haptic/dummy/*.c \
# src/loadso/dlopen/*.c
# src/sensor/*.c \
# src/sensor/dummy/*.c \
# src/hidapi/*.c \
CORESOURCES = src/core/morphos/*.c
COREOBJECTS = $(shell echo $(CORESOURCES) | sed -e 's,\.c,\.o,g')
OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
all: $(LIBRARY) lib
sdk: $(LIBRARY)
mkdir -p /usr/local/bin
mkdir -p /usr/local/include/SDL2
mkdir -p /usr/local/lib
mkdir -p /usr/local/lib/libb32
cp include/*.h /usr/local/include/SDL2
cp src/core/morphos/devenv/lib/libSDL2.a /usr/local/lib/libSDL2.a
cp src/core/morphos/devenv/lib/libb32/libSDL2.a /usr/local/lib/libb32/libSDL2.a
cp sdl2-config /usr/local/bin/sdl2-config
headers:
$(HEADERING)
@cvinclude.pl --fd=src/core/morphos/sdk/fd/sdl2_lib.fd --clib=src/core/morphos/sdk/clib/sdl2_protos.h --proto=src/core/morphos/sdk/proto/sdl2.h
@cvinclude.pl --fd=src/core/morphos/sdk/fd/sdl2_lib.fd --clib=src/core/morphos/sdk/clib/sdl2_protos.h --inline=src/core/morphos/sdk/ppcinline/sdl2.h
@perl -pe "s/va_list __t__p1 = __p1;/va_list __t__p1;\\\\\n\t\tva_copy(__t__p1, __p1);/g" src/core/morphos/sdk/ppcinline/sdl2.h > src/core/morphos/sdk/ppcinline/sdl2tmp.h
@perl -pe "s/va_list __t__p2 = __p2;/va_list __t__p2;\\\\\n\t\tva_copy(__t__p2, __p2);/g" src/core/morphos/sdk/ppcinline/sdl2tmp.h > src/core/morphos/sdk/ppcinline/sdl2.h
@perl -pe "s/va_list __t__p3 = __p3;/va_list __t__p3;\\\\\n\t\tva_copy(__t__p3, __p3);/g" src/core/morphos/sdk/ppcinline/sdl2.h > src/core/morphos/sdk/ppcinline/sdl2tmp.h
@rm src/core/morphos/sdk/ppcinline/sdl2.h
@rename src/core/morphos/sdk/ppcinline/sdl2tmp.h src/core/morphos/sdk/ppcinline/sdl2.h
lib:
@cd src/core/morphos/devenv; if ! $(MAKE) $(MAKECMDGOALS); then exit 1; fi;
install: $(LIBRARY) lib
cp $(LIBRARY) Libs:
-flushlib $(LIBRARY)
src/video/SDL_blit_N.o: src/video/SDL_blit_N.c
$(CC) $(CFLAGS) -fvec -maltivec -faltivec -mabi=altivec -o $@ -c src/video/SDL_blit_N.c
src/core/morphos/SDL_cpu.o: src/core/morphos/SDL_cpu.c
$(CC) $(CFLAGS) -fvec -maltivec -faltivec -mabi=altivec -o $@ -c $^
src/core/morphos/SDL_library.o: src/core/morphos/SDL_library.c src/core/morphos/SDL_library.h src/core/morphos/SDL_stubs.h
$(COMPILING)
@$(CC) -mcpu=750 $(INCLUDE) -Wall -fno-strict-aliasing -DAROS_ALMOST_COMPATIBLE -o $@ -c $*.c
$(TARGET): $(OBJECTS)
$(ARCHIVING)
@$(AR) crvs $@ $^
$(LIBRARY): $(TARGET) $(COREOBJECTS)
$(LINKING)
@$(CC) -nostartfiles -mresident32 -Wl,-Map=sdl2.map $(COREOBJECTS) -o [email protected] -L. -lSDL2 -lm
$(STRIPPING)
@ppc-morphos-strip -o $@ --remove-section=.comment [email protected]
clean:
rm -f $(LIBRARY) $(TARGET) $(OBJECTS) $(COREOBJECTS) *.db *.s
@cd src/core/morphos/devenv; if ! $(MAKE) $(MAKECMDGOALS); then exit 1; fi;
dump:
ppc-morphos-objdump --disassemble-all --reloc $(LIBRARY).db >$(LIBRARY).s