initial commit
This commit is contained in:
40
Makefile
Normal file
40
Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/make -f
|
||||
SHELL :=/bin/sh
|
||||
.SHELLFLAGS :=-efc
|
||||
MAKEFLAGS +=--no-print-directory
|
||||
|
||||
SRC = main.cc coreutils-sort.cc overlay.cc print.cc sort.cc xxhash.cc
|
||||
|
||||
CROSS ?=
|
||||
CC =$(CROSS)gcc
|
||||
CXX =$(CROSS)g++
|
||||
STRIP =$(CROSS)strip
|
||||
|
||||
CFLAGS_LTO ?=-flto=2 -fuse-linker-plugin -ffat-lto-objects -flto-partition=none
|
||||
CFLAGS_COMMON ?=-O2 -g -fPIE -fstack-protector-strong
|
||||
CFLAGS ?=$(CFLAGS_COMMON) $(CFLAGS_LTO)
|
||||
CPPFLAGS ?=-Wall -Wextra -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
|
||||
CXXFLAGS ?=$(CFLAGS_COMMON) $(CFLAGS_LTO) -std=gnu++20
|
||||
LDFLAGS ?=-Wl,-z,relro -Wl,-z,now -pie
|
||||
|
||||
NO_WARN = attributes class-memaccess unused-function unused-result
|
||||
CPPFLAGS += $(foreach w,$(NO_WARN),-Wno-$(w))
|
||||
|
||||
NO_CXX = rtti exceptions
|
||||
CXXFLAGS +=$(foreach f,$(NO_CXX),-fno-$(f))
|
||||
|
||||
OBJ = $(SRC:.cc=.cc.o)
|
||||
|
||||
.DEFAULT: all
|
||||
.PHONY: all build clean
|
||||
all build: overlaydirs
|
||||
|
||||
%.cc.o: %.cc
|
||||
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $^
|
||||
|
||||
overlaydirs: $(OBJ)
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ \
|
||||
$(if $(filter $(RELMODE),1),&& $(STRIP) --strip-debug --strip-unneeded $@)
|
||||
|
||||
clean:
|
||||
rm -f overlaydirs $(OBJ)
|
Reference in New Issue
Block a user