Skip to content

Commit

Permalink
Better Makefile options for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Al-Azif committed Nov 1, 2021
1 parent 0f897c2 commit 775eb30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ LIBS := -lSceLibcInternal -lkernel
INCLUDES := -Iinclude

# Additional compile flags
ERRORFLAGS := -Wall -Wextra -Werror
OTHERFLAGS :=
# ERRORFLAGS and OTHERFLAGS will be included in C and C++ flags
# OTHERCXXFLAGS will only be included in C++ flags
ERRORFLAGS := -Wall -Wextra -Wpedantic -Werror
OTHERFLAGS := -O3 -std=c99 -D_DEFAULT_SOURCE
OTHERCXXFLAGS := -std=c++11

# -----------------------------------------------------------------------------
# Do not edit below this line unless you know what you are doing
# -----------------------------------------------------------------------------

# Compiler options. You likely won't need to touch these.
TOOLCHAIN := $(OO_PS4_TOOLCHAIN)
ODIR := build
SDIR := src
EXTRAFLAGS := $(INCLUDES) $(ERRORFLAGS) $(OTHERFLAGS)
CFLAGS := -cc1 -triple x86_64-pc-freebsd-elf -munwind-tables -fuse-init-array -debug-info-kind=limited -debugger-tuning=gdb -emit-obj -isysroot $(TOOLCHAIN) -isystem $(TOOLCHAIN)/include $(EXTRAFLAGS)
CXXFLAGS := $(CFLAGS) -isystem $(TOOLCHAIN)/include/c++/v1
CFLAGS := -cc1 -triple x86_64-pc-freebsd-elf -munwind-tables -fuse-init-array -emit-obj -isysroot $(TOOLCHAIN) -isystem $(TOOLCHAIN)/include $(EXTRAFLAGS)
CXXFLAGS := $(CFLAGS) -isystem $(TOOLCHAIN)/include/c++/v1 $(OTHERCXXFLAGS)
LFLAGS := -m elf_x86_64 -pie --script $(TOOLCHAIN)/link.x --eh-frame-hdr -L$(TOOLCHAIN)/lib $(LIBS) $(TOOLCHAIN)/lib/crtlib.o

CFILES := $(wildcard $(SDIR)/*.c)
Expand Down Expand Up @@ -66,7 +72,7 @@ $(ODIR)/%.o: $(SDIR)/%.s
$(AS) -triple=x86_64-pc-freebsd-elf --filetype=obj -o $@ $<

$(ODIR)/%.o.stub: $(SDIR)/%.cpp
$(CXX) -target x86_64-pc-linux-gnu -ffreestanding -nostdlib -fno-builtin -fPIC -c -isysroot $(TOOLCHAIN) -isystem $(TOOLCHAIN)/include -isystem $(TOOLCHAIN)/include/c++/v1 $(EXTRAFLAGS) -o $@ $<
$(CXX) -target x86_64-pc-linux-gnu -ffreestanding -nostdlib -fno-builtin -fPIC -c -isysroot $(TOOLCHAIN) -isystem $(TOOLCHAIN)/include -isystem $(TOOLCHAIN)/include/c++/v1 $(EXTRAFLAGS) $(OTHERCXXFLAGS) -o $@ $<

$(ODIR)/%.o.stub: $(SDIR)/%.c
$(CC) -target x86_64-pc-linux-gnu -ffreestanding -nostdlib -fno-builtin -fPIC -c -isysroot $(TOOLCHAIN) -isystem $(TOOLCHAIN)/include $(EXTRAFLAGS) -o $@ $<
Expand Down
4 changes: 3 additions & 1 deletion src/pc-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ int main() {

return 0;
}

#else
// ISO C requires a translation unit to contain at least one declaration
int empty_declaration;
#endif

0 comments on commit 775eb30

Please sign in to comment.