forked from libsdl-org/SDL-1.2
-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile.amigaos4
108 lines (86 loc) · 3.44 KB
/
makefile.amigaos4
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
# This makefile is created to avoid using configure and libtool.
# It is specific to AmigaOS 4.x.
# It compiles libraries and tests as well, using a build directory that mimics the hierarchy
# of src and test directories:
# build/
# static/
# src/
# test/
# shared/
# src/
# test/
#
# It is at the moment in-progress work. To do:
# - Check in various contexts
# - Implement the shared library part
SHELL = /bin/sh
CC = ppc-amigaos-gcc
INCLUDE = -I./include
CFLAGS = -gstabs -O2 -Wall
LDFLAGS =
AR = ppc-amigaos-ar
RANLIB = ppc-amigaos-ranlib
PIC_CFLAGS = -fPIC -DPIC
DEBUG_CFLAGS = -DDEBUG
AMIGADATE = $(shell date +"%-d.%-m.%Y")
### Sources and objects files, build directories ###
SOURCES = $(wildcard src/*.c src/audio/*.c src/cdrom/*.c src/cpuinfo/*.c src/events/*.c src/file/*.c src/stdlib/*.c \
src/video/*.c src/joystick/*.c src/video/dummy/*.c src/audio/disk/*.c src/audio/dummy/*.c src/video/amigaos4/*.c src/audio/amigaos4/*.c \
src/thread/*.c src/timer/*.c src/thread/amigaos4/*.c src/thread/generic/SDL_syscond.c \
src/timer/amigaos4/*.c src/main/amigaos4/SDL_os4timer.c src/joystick/amigaos4/*.c src/cdrom/amigaos4/*.c src/loadso/amigaos4/*.c)
TESTS_SOURCES = $(wildcard test/*.c)
STATIC_OBJDIR := build/static
STATIC_OBJS := $(patsubst %.c,%.o, $(addprefix $(STATIC_OBJDIR)/,$(SOURCES)))
STATIC_TESTS_OBJDIR := $(STATIC_OBJDIR)/test
STATIC_TESTS := $(patsubst %.c,%, $(addprefix $(STATIC_OBJDIR)/,$(TESTS_SOURCES)))
SHARED_OBJDIR := build/shared
SHARED_OBJS := $(patsubst %.c,%.o, $(addprefix $(SHARED_OBJDIR)/,$(SOURCES)))
SHARED_TESTS_OBJDIR := $(SHARED_OBJDIR)/test
SHARED_TESTS := $(patsubst %.c,%, $(addprefix $(SHARED_OBJDIR)/,$(TESTS_SOURCES)))
### Implicit compilation rules ###
$(STATIC_OBJDIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) $(INCLUDE) $(CFLAGS) $(DEBUG_CFLAGS) -o $@ -c $<
$(STATIC_OBJDIR)/test/%: $(STATIC_OBJDIR)/test/%.o
@echo Link test $@
@mkdir -p $(dir $@)
$(CC) -L./$(STATIC_OBJDIR) -o $@ $< -lSDL
# build tests without PIC
$(SHARED_OBJDIR)/test/%.o: test/%.c
@mkdir -p $(dir $@)
$(CC) $(INCLUDE) $(CFLAGS) $(DEBUG_CFLAGS) -o $@ -c $<
$(SHARED_OBJDIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) $(PIC_CFLAGS) $(INCLUDE) $(CFLAGS) $(DEBUG_CFLAGS) -D__AMIGADATE__=\"$(AMIGADATE)\" -o $@ -c $<
$(SHARED_OBJDIR)/test/%: $(SHARED_OBJDIR)/test/%.o
@echo Link test $@
@mkdir -p $(dir $@)
$(CC) -o $@ $< -use-dynld -lSDL -athread=native
### Targets ###
all: $(STATIC_OBJDIR)/libSDL.a $(SHARED_OBJDIR)/libSDL-1.2.so $(STATIC_TESTS_OBJDIR) $(SHARED_TESTS_OBJDIR)
@echo "Build complete"
$(STATIC_OBJDIR)/libSDL.a: $(STATIC_OBJS)
$(AR) rcu $@ $^
$(RANLIB) $@
ls -l $@
$(SHARED_OBJDIR)/libSDL-1.2.so: $(SHARED_OBJS)
$(CC) -shared -Wl,-soname,libSDL-1.2.so -o $@ $^
$(STATIC_TESTS_OBJDIR): $(STATIC_TESTS)
cp test/icon.bmp $(STATIC_OBJDIR)/test/
cp test/picture.xbm $(STATIC_OBJDIR)/test/
cp test/sail.bmp $(STATIC_OBJDIR)/test/
cp test/sample.bmp $(STATIC_OBJDIR)/test/
cp test/sample.wav $(STATIC_OBJDIR)/test/
cp test/utf8.txt $(STATIC_OBJDIR)/test/
cp test/moose.dat $(STATIC_OBJDIR)/test/
$(SHARED_TESTS_OBJDIR): $(SHARED_TESTS)
cp test/icon.bmp $(SHARED_OBJDIR)/test/
cp test/picture.xbm $(SHARED_OBJDIR)/test/
cp test/sail.bmp $(SHARED_OBJDIR)/test/
cp test/sample.bmp $(SHARED_OBJDIR)/test/
cp test/sample.wav $(SHARED_OBJDIR)/test/
cp test/utf8.txt $(SHARED_OBJDIR)/test/
cp test/moose.dat $(SHARED_OBJDIR)/test/
clean:
#rm -rf $(STATIC_TESTS_OBJDIR) $(SHARED_TESTS_OBJDIR)
rm -rf $(STATIC_OBJDIR) $(SHARED_OBJDIR)