initial commit, compiles
This commit is contained in:
93
Makefile
Normal file
93
Makefile
Normal file
@@ -0,0 +1,93 @@
|
||||
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 \
|
||||
-DDATE=$(shell date '+%Y-%m-%d') \
|
||||
-DSSTRIP_VERSION=$(SSTRIP_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 uninstall
|
||||
|
||||
all: glxgears
|
||||
|
||||
-include glxgears.d
|
||||
|
||||
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
|
Reference in New Issue
Block a user