mirror of
https://github.com/NotAShelf/tinierfetch.git
synced 2025-11-01 19:48:50 +00:00
separate programs by language
This commit is contained in:
parent
45f6cbb46a
commit
6295a0b7e6
8 changed files with 106 additions and 4 deletions
46
cpp/Makefile
Normal file
46
cpp/Makefile
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Compiler
|
||||
CXX = g++
|
||||
|
||||
# Source files
|
||||
SOURCES = tinierfetch.cpp
|
||||
|
||||
# Output binaries
|
||||
OUTPUT_SIZE = tinierfetch-cpp-size
|
||||
OUTPUT_SPEED = tinierfetch-cpp-speed
|
||||
|
||||
# Compiler flags for size optimization
|
||||
CXXFLAGS_SIZE = -Os -ffunction-sections -fdata-sections \
|
||||
-fno-exceptions -fno-stack-protector -fno-rtti \
|
||||
-ffunction-sections -fdata-sections -fno-math-errno \
|
||||
-fno-unroll-loops -fmerge-all-constants -fno-ident \
|
||||
-mfpmath=387 -mfancy-math-387 -s -flto \
|
||||
-fno-asynchronous-unwind-tables -fsingle-precision-constant
|
||||
|
||||
# Compiler flags for speed optimization
|
||||
CXXFLAGS_SPEED = -O3 -march=native -funroll-loops -finline-functions \
|
||||
-ffast-math -fno-exceptions -fno-stack-protector -fno-rtti \
|
||||
-ffunction-sections -fdata-sections -fno-math-errno \
|
||||
-fmerge-all-constants -fno-ident -mfpmath=387 \
|
||||
-mfancy-math-387 -s -flto -fno-asynchronous-unwind-tables \
|
||||
-fsingle-precision-constant
|
||||
|
||||
# Linker flags (common for both targets)
|
||||
LDFLAGS = -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,--strip-all
|
||||
|
||||
# Makefile targets
|
||||
all: optimize-size optimize-speed
|
||||
|
||||
optimize-size: $(OUTPUT_SIZE)
|
||||
|
||||
optimize-speed: $(OUTPUT_SPEED)
|
||||
|
||||
$(OUTPUT_SIZE): $(SOURCES)
|
||||
$(CXX) $(CXXFLAGS_SIZE) $(LDFLAGS) $(SOURCES) -o ../bin/$(OUTPUT_SIZE)
|
||||
|
||||
$(OUTPUT_SPEED): $(SOURCES)
|
||||
$(CXX) $(CXXFLAGS_SPEED) $(LDFLAGS) $(SOURCES) -o ../bin/$(OUTPUT_SPEED)
|
||||
|
||||
clean:
|
||||
rm -f $(OUTPUT_SIZE) $(OUTPUT_SPEED)
|
||||
|
||||
.PHONY: all optimize-size optimize-speed clean
|
||||
10
cpp/tinierfetch.cpp
Normal file
10
cpp/tinierfetch.cpp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <iostream>
|
||||
#define l getenv
|
||||
#define i <<
|
||||
int main() {
|
||||
std::cout i "\e[31muser:\e[0m " i l("USER") i "\n\e[32msh:\e[0m " i l("SHELL")
|
||||
i "\n\e[33mterm:\e[0m " i l("TERM") i "\n\e[34mlocale:\e[0m " i l("LANG")
|
||||
i "\n\x1b[35mcolors: \x1b[0m\x1b[41m \x1b[42m \x1b[43m \x1b[44m "
|
||||
"\x1b[45m \x1b[0m\n";
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue