-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.gcw
35 lines (28 loc) · 1.06 KB
/
Makefile.gcw
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
PRGNAME = srb2
# define regarding OS, which compiler to use
CC = mipsel-linux-gcc
CCP = mipsel-linux-g++
LD = mipsel-linux-gcc
# change compilation / linking flag options
F_OPTS = -Isrc -DHAVE_SDL -DNOMUMBLE -DNONET -DNOIPX -DDNO_IPV6 -DHAVE_MIXER -DGCW0 -DNOPOSTPROCESSING
CC_OPTS = -Ofast -mips32r2 -fdata-sections -ffunction-sections $(F_OPTS)
CFLAGS = $(shell sdl-config --cflags) $(CC_OPTS)
CXXFLAGS =$(CFLAGS)
LDFLAGS = -lSDL -lm -Wl,--as-needed -Wl,--gc-sections -flto -lSDL_mixer -s
# Files to be compiled
SRCDIR = ./src ./src/sdl12
VPATH = $(SRCDIR)
SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
SRC_CP = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.cpp))
OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
OBJ_CP = $(notdir $(patsubst %.cpp, %.o, $(SRC_CP)))
OBJS = $(OBJ_C) $(OBJ_CP)
# Rules to make executable
$(PRGNAME): $(OBJS)
$(LD) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
$(OBJ_C) : %.o : %.c
$(CC) $(CFLAGS) -c -o $@ $<
$(OBJ_CP) : %.o : %.cpp
$(CCP) $(CXXFLAGS) -c -o $@ $<
clean:
rm -f *.o