Skip to content

Commit

Permalink
Added size option to makefiles (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerjenigeUberMensch authored Nov 1, 2024
1 parent 8a80712 commit 4a03b7b
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ ARCH64 = -march=x86-64
ARCH = ${ARCH64} ${ARCHALL}
# General compiler flags
COMPILE_FLAGS = ${CCFLAGS} ${PRELINKERFLAGS} ${ARCH}
COMPILE_FLAGS += -DXINERAMA -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" -DMARK=\"${MARK}\"
COMPILE_FLAGS += -DXINERAMA -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DNDEBUG -DVERSION=\"${VERSION}\" -DMARK=\"${MARK}\"
# Additional release-specific flags
RCOMPILE_FLAGS = -DNDEBUG ${RELEASES}
RCOMPILE_FLAGS = ${RELEASES}
SCOMPILE_FLAGS = ${SIZEONLY}
# Additional debug-specific flags
DCOMPILE_FLAGS = -DDEBUG -DENABLE_DEBUG -DXCB_TRL_ENABLE_DEBUG ${DEBUG}
# Add additional include paths
Expand Down Expand Up @@ -101,12 +102,18 @@ release: export CFLAGS := $(CFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS)
release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS)
debug: export CFLAGS := $(CFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS)
debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS)
size: export CFLAGS := $(CFLAGS) $(COMPILE_FLAGS) $(SCOMPILE_FLAGS)
size: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS)


# Build and output paths
release: export BUILD_PATH := build/release
release: export BIN_PATH := bin/release
debug: export BUILD_PATH := build/debug
debug: export BIN_PATH := bin/debug
size: export BUILD_PATH := build/size
size:export BIN_PATH := bin/size

install: export BIN_PATH := bin/release

# Find all source files in the source directory, sorted by most
Expand Down Expand Up @@ -185,6 +192,19 @@ endif
@echo -n "Total build time: "
@$(END_TIME)

.PHONY: size
size: dirs
ifeq ($(USE_VERSION), true)
@echo "Beginning size build v$(VERSION_STRING)"
else
@echo "Beginning size build"
endif
@$(START_TIME)
@$(MAKE) all --no-print-directory
@echo -n "Total build time: "
@$(END_TIME)


# Debug build for gdb debugging
.PHONY: debug
debug: dirs
Expand Down

0 comments on commit 4a03b7b

Please sign in to comment.