8404b1695c
I can't get argp_program_version working...
95 lines
2.1 KiB
Makefile
95 lines
2.1 KiB
Makefile
# Options (e.g. `CFLAGS=-DHAVE_ARGP make`)
|
|
# HAVE_ARGP: use `argp` for argument parsing.
|
|
|
|
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 \
|
|
$(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-missing-field-initializers \
|
|
-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
|