summaryrefslogtreecommitdiff
path: root/Makefile
blob: a9aab372515405adb95942e099168a0c1e6fb8f0 (plain)
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
TARGET      := gpsp_libretro.so

CC  = gcc
AR  = psp-ar
STATIC_LINKING = 0

CFLAGS   += -fPIC -Werror-implicit-function-declaration
CFLAGS   += -DPC_BUILD -Wall -m32
CFLAGS   += -D__LIBRETRO__


ifeq ($(DEBUG), 1)
OPTIMIZE	      := -O0 -g
OPTIMIZE_SAFE  := -O0 -g
else
OPTIMIZE	      := -O3
OPTIMIZE_SAFE  := -O2
endif


OBJS := main.o
OBJS += cpu.o
OBJS += memory.o
OBJS += video.o
OBJS += input.o
OBJS += sound.o
OBJS += cpu_threaded.o

OBJS += x86/x86_stub.o
OBJS += cheats.o
OBJS += zip.o

OBJS += libretro.o



ASFLAGS = $(CFLAGS)
INCDIRS := -I.
LDFLAGS += -shared -m32
LDLIBS  += -lz


all: $(TARGET)

$(TARGET): $(OBJS)
ifeq ($(STATIC_LINKING), 1)
	$(AR) rcs $@ $(OBJS)
else
	$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS)
endif

%.o: %.c
	$(CC) -c -o $@ $< $(CFLAGS) $(OPTIMIZE) $(INCDIRS)

cpu.o: cpu.c
	$(CC) -c -o $@ $< $(CFLAGS) -Wno-unused-variable -Wno-unused-label $(OPTIMIZE_SAFE) $(INCDIRS)

%.o: %.S
	$(CC) -c -o $@ $< $(ASFLAGS) $(OPTIMIZE)

clean:
#	rm -f main.o cpu.o memory.o video.o input.o sound.o cpu_threaded.o x86_stub.o cheats.o zip.o libretro.o
	rm -f $(OBJS)
	rm -f $(TARGET)

.PHONY: $(TARGET) clean