trans-glxgears-fork/Makefile
2023-11-01 10:22:46 -05:00

91 lines
2.0 KiB
Makefile

prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
mandir ?= $(datarootdir)/man
man1dir ?= $(mandir)/man1
GZIP_PROG ?= gzip -cn9
INSTALL ?= install -D
INSTALL_PROGRAM ?= $(INSTALL)
INSTALL_DATA ?= $(INSTALL) -m 644
RM ?= rm -f
CPPFLAGS := \
-D_FORTIFY_SOURCE=2 \
-DVERSION=$(VERSION) \
$(CPPFLAGS)
OFLAGS := -O3 \
-falign-functions=1 \
-falign-jumps=1 \
-falign-loops=1 \
-fmerge-all-constants \
-fno-asynchronous-unwind-tables \
-fno-ident \
-fno-plt \
-fno-stack-protector \
-fno-unwind-tables \
-fomit-frame-pointer \
-fwhole-program \
$(OFLAGS)
WFLAGS := \
-Wall \
-Werror \
-Wextra \
-Wformat-security \
-Wno-ignored-optimization-argument \
-Wno-unknown-warning-option \
-Wsuggest-attribute=const \
-Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn \
-Wsuggest-attribute=pure \
$(WFLAGS)
CFLAGS := \
-g0 \
-MD \
-MP \
-pipe \
$(OFLAGS) \
$(WFLAGS) \
$(CFLAGS)
LDFLAGS := \
-Wl,--build-id=none \
-Wl,--gc-sections \
-Wl,-znoexecstack \
-Wl,-znorelro \
-Wl,-znoseparate-code \
$(LDFLAGS)
LDLIBS := -lGL -lglut -lm -lX11
MAKEFLAGS := \
--jobs=$(shell nproc) \
$(MAKEFLAGS)
.PHONY: all clean install run uninstall
all: glxgears
-include glxgears.d
run: glxgears
vblank_mode=0 __GL_SYNC_TO_VBLANK=0 $<
clean:
$(RM) glxgears glxgears.i glxgears.s glxgears.o
$(DESTDIR)$(bindir)/glxgears: glxgears
$(INSTALL_PROGRAM) $< $@
install: $(DESTDIR)$(bindir)/glxgears
uninstall:
$(RM) $(DESTDIR)$(bindir)/glxgears
# References:
# https://archive.mesa3d.org/demos
# https://gitlab.freedesktop.org/mesa/demos/-/blob/main/src/demos/gears.c
# https://www.gnu.org/prep/standards/html_node/Command-Variables.html
# https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
# https://www.gnu.org/prep/standards/html_node/Standard-Targets.html
# https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
# https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html