-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.gcw
37 lines (29 loc) · 1.09 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
36
37
PRGNAME = hexahop
# define regarding OS, which compiler to use
CC = /opt/gcw0-toolchain/bin/mipsel-linux-gcc
CCP = /opt/gcw0-toolchain/bin/mipsel-linux-g++
LD = /opt/gcw0-toolchain/bin/mipsel-linux-gcc
DATADIR = "./data"
# change compilation / linking flag options
F_OPTS = -Isrc -DRELATIVE_PATHS
CC_OPTS = -Ofast -fdata-sections -ffunction-sections -mips32r2 -flto $(F_OPTS)
CFLAGS = $(CC_OPTS)
CXXFLAGS =$(CFLAGS)
LDFLAGS = -lSDLmain -lSDL -lm -lSDL_mixer -lSDL_ttf -lstdc++ -Wl,--as-needed -Wl,--gc-sections -flto -s
# Files to be compiled
SRCDIR = ./src
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 $(PRGNAME) *.o