-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
95 lines (76 loc) · 2.47 KB
/
Makefile
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
NAME := OpenFNaF
#------------------------------------------------
BUILD := build
SOURCE := src/
PC_WRAPPER_SRC := src/pc/
PSP_WRAPPER_SRC := src/psp/
#------------------------------------------------
SOURCES := $(shell find $(SOURCE) -maxdepth 1 -name '*.c')
# PLATFORM: PC
ifeq ($(DESKTOP),1)
SOURCES += $(shell find $(PC_WRAPPER_SRC) -name '*.c')
CFLAGS := -DDESKTOP -fPIC
endif
# PLATFORM: PSP
ifeq ($(PSP),1)
SOURCES += $(shell find $(PSP_WRAPPER_SRC) -name '*.c')
SOURCES += libs/gLib2D/glib2d.c
CFLAGS := -DPSP
endif
OBJECTS := $(addprefix $(BUILD)/,$(SOURCES:%.c=%.o))
#-------------------------------------------------
CFLAGS += -Wall -g
LDFLAGS := -llua -lm -lc
# PLATFORM: PC
ifeq ($(DESKTOP),1)
LDFLAGS += -lraylib
endif
# PLATFORM: PSP
ifeq ($(PSP),1)
LDFLAGS += libs/libosl.a
LDFLAGS += -lpspgum_vfpu -lpspvfpu -lpspgu -lpspvram -lpspaudiocodec
LDFLAGS += -lpspaudiolib -lpspaudio -lpspmp3 -lpsprtc -lpsppower -lpsphprm -ljpeg -lpng -lz
endif
# PSP: Uses more automated building tech using its custom SDK build.mak
ifneq ($(PSP),1)
#-------------------------------------------------
OUTPUT_BOLD := `tput bold`
OUTPUT_GREEN := `tput setaf 2`
OUTPUT_BLUE := `tput setaf 6`
OUTPUT_NORMAL := `tput sgr0`
#-------------------------------------------------
all: $(NAME)
#-------------------------------------------------
#-------------------------------------------------
$(NAME): $(OBJECTS)
#-------------------------------------------------
@echo Linking...
@$(CC) $(CFLAGS) -o $(NAME) $(OBJECTS) $(LDFLAGS)
@mv $(NAME) pc/
@echo $(OUTPUT_BOLD)$(OUTPUT_GREEN)Build done.$(OUTPUT_NORMAL)
#-------------------------------------------------
$(BUILD)/%.o: %.c
#-------------------------------------------------
@echo $(OUTPUT_BOLD)- $(subst $(SOURCE)/,,$<)$(OUTPUT_NORMAL)
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -I$(dir $<) -c $< -o $@
#-------------------------------------------------
clean:
#-------------------------------------------------
@echo $(OUTPUT_BLUE)$(OUTPUT_BOLD)Cleaning...$(OUTPUT_NORMAL)
@rm -rf $(BUILD) $(NAME)
endif
# Special PSP Building
ifeq ($(PSP),1)
TARGET = $(NAME)
INCDIR = $(PSPPATH)/include
INCDIR += libs
OBJS = $(SOURCES)
LIBS = $(LDFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = OpenFNaF
PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
install: EBOOT.PBP
mv EBOOT.PBP psp/
endif