forked from HACKERCHANNEL/PSL1GHT
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (59 loc) · 1.7 KB
/
Makefile
File metadata and controls
76 lines (59 loc) · 1.7 KB
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
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
UNAME := $(shell uname -s)
ifeq ($(strip $(PS3DEV)),)
ifeq ($(strip $(DEVKITPS3)),)
export PS3DEV := /usr/local/ps3dev
else
export PS3DEV := $(DEVKITPS3)
endif
endif
CFLAGS := $(DEBUGFLAGS) -O2 -Wall --std=gnu99
LDFLAGS := $(DEBUGFLAGS)
ifneq (,$(findstring MINGW,$(UNAME)))
POSTFIX := .exe
CFLAGS += -mno-cygwin
LDFLAGS += -mno-cygwin -s -lelf
OS := win32
endif
ifneq (,$(findstring CYGWIN,$(UNAME)))
POSTFIX := .exe
LDFLAGS += -s -lelf
OS := win32
endif
ifneq (,$(findstring Darwin,$(UNAME)))
CFLAGS += -I/opt/local/include -I/usr/local/opt/libelf/include/libelf \
-I/opt/homebrew/include -I/opt/homebrew/opt/libelf/include/libelf
LDFLAGS += -L/opt/local/lib -L/opt/homebrew/lib -lelf
OS := Mac
endif
ifneq (,$(findstring BSD,$(UNAME)))
LDFLAGS += -lelf
endif
ifneq (,$(findstring SunOS,$(UNAME)))
LDFLAGS += -lelf
endif
ifneq (,$(findstring Linux,$(UNAME)))
LDFLAGS += -lelf
OS := Linux
endif
TARGET := sprxlinker$(POSTFIX)
SOURCE := .
INCLUDE := .
CC := gcc
CFILES := $(foreach dir,$(SOURCE),$(wildcard $(dir)/*.c))
INCLUDES := $(foreach dir,$(INCLUDE),-I$(dir))
all: $(TARGET)
install: all
@echo Installing $(TARGET)
@[ -d $(PS3DEV)/bin ] || mkdir -p $(PS3DEV)/bin
@install -m 755 $(TARGET) $(PS3DEV)/bin
clean:
@echo clean ...
@rm -rf $(TARGET)
$(TARGET): $(CFILES)
@echo building ... $(notdir $@)
@$(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LDFLAGS)