aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxapi/makefile
blob: f300e5faa87f75d72a7206c3201fc453be7f4149 (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
# PSn00bSDK library makefile
# Part of the PSn00bSDK Project
# 2019 - 2021 Lameguy64 / Meido-Tek Productions

## Settings

PSN00BSDK_LIBS	?= ..

include ../../psn00bsdk-setup.mk

# Project target name
TARGET	= libpsxapi.a

## Files

SOURCES	= stdio fs sys

# Searches for C, C++ and S (assembler) files in local directory
CFILES	= $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.c))
CXXFILES= $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.cxx))
AFILES	= $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.s))

# Create names for object files
OFILES	= $(addprefix build/,$(CFILES:.c=.o)) \
	$(addprefix build/,$(CXXFILES:.cxx=.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: build/$(TARGET)

build/$(TARGET): $(OFILES)
	@mkdir -p $(dir $@)
	$(AR) crs $@ $(OFILES)

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

build/%.o: %.cxx
	@mkdir -p $(dir $@)
	$(CXX) $(CPPFLAGS_LIB) $(INCLUDE) -c $< -o $@
	
build/%.o: %.s
	@mkdir -p $(dir $@)
	$(CC) $(AFLAGS_LIB) $(INCLUDE) -c $< -o $@

install:
ifneq ($(PSN00BSDK_LIBS), "..")
	@mkdir -p $(PSN00BSDK_LIBS)
endif
	cp build/$(TARGET) $(PSN00BSDK_LIBS)/$(TARGET)
	
clean:
	rm -rf build