aboutsummaryrefslogtreecommitdiff
path: root/examples/beginner/cppdemo/makefile
blob: 630a2804f967cb3cc29838591f8597e68b8ac2b6 (plain) (blame)
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
# PSn00bSDK makefile template
# Part of the PSn00bSDK Project
# 2019 - 2021 Lameguy64 / Meido-Tek Productions

## Settings

PSN00BSDK_LIBS	?= ../../../libpsn00b

# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
# root folder (it only depends on environment variables).
include ../../../psn00bsdk-setup.mk

# Project target name
TARGET	= cppdemo

## Files

# Searches for C, C++ and S (assembler) files in local directory
CFILES	= $(notdir $(wildcard *.c))
CPPFILES= $(notdir $(wildcard *.cpp))
AFILES	= $(notdir $(wildcard *.s))

# Create names for object files
OFILES	= $(addprefix build/,$(CFILES:.c=.o)) \
	$(addprefix build/,$(CPPFILES:.cpp=.o)) \
	$(addprefix build/,$(AFILES:.s=.o))

# Project specific includes and libraries
# (use -I for include dirs, -L for library dirs, -l for static libraries)
INCLUDE	+=
LIBDIRS	+=
LIBS	+=

## Build rules

#all: iso
all: build/$(TARGET)

iso: build/$(TARGET) resources
	$(MKPSXISO) -y -q iso.xml

resources:
	# Add commands to build/convert your assets here
	#$(LZPACK) data.xml

build/$(TARGET): $(OFILES)
	@mkdir -p $(dir $@)
	$(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
	$(NM) -f posix -l -n $@ >$@.map
	$(ELF2X) -q $@ $@.exe

build/%.o: %.c
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@

build/%.o: %.cpp
	@mkdir -p $(dir $@)
	$(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@

build/%.o: %.s
	@mkdir -p $(dir $@)
	$(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@

clean:
	rm -rf build