some work on x11 ext

This commit is contained in:
veclavtlica
2026-10-13 04:30:06 +03:00
parent 964e623644
commit 5789cafd4e
13 changed files with 262 additions and 144 deletions
+23 -10
View File
@@ -1,27 +1,37 @@
CC = clang
CC ?= clang
RELEASE ?= 0 # Optimize.
DEBUG ?= 1 # Emit debug info.
SQUEEZE ?= 0 # Nuclear option to save space.
BITS ?= 64
RUN ?= 0
ISCLANG = 1
CFLAGS = -Wall -std=gnu99 -ffast-math -fno-ident -fvisibility=hidden
# Set cosmopolitan toolchain.
ifeq ($(MAKECMDGOALS),cosmo)
ISCLANG = 0
CC = ./Cosmo/bin/cosmocc -mclang
ifeq ($(DEBUG), 1)
CFLAGS += -mdbg
else
CFLAGS += -mtiny
endif
endif
CFLAGS = -Wall -std=gnu99 -ffast-math -fno-ident -fvisibility=hidden
ifeq ($(ISCLANG), 1)
CFLAGS = -flto=thin -fuse-ld=lld
# Provide LTO where it's applicable.
ifeq ($(CC),clang)
ISCLANG = 1
CFLAGS += -flto=thin -fuse-ld=lld
else
ifneq ($(MAKECMDGOALS),cosmo)
CFLAGS += -flto
endif
endif
# Linux specific options.
ifeq ($(MAKECMDGOALS),linux)
CFLAGS += -fno-pic -fno-pie
ifeq ($(RELEASE), 1)
CFLAGS += -Wl,--ignore-data-address-equality -Wl,--ignore-function-address-equality \
# CFLAGS += -Wl,--ignore-data-address-equality -Wl,--ignore-function-address-equality \
-Wl,--optimize-bb-jumps
endif
ifeq ($(SQUEEZE), 1)
@@ -37,11 +47,15 @@ ifeq ($(MAKECMDGOALS),linux)
CFLAGS += -m32 -msse2
endif
endif
# WASM specific options.
ifeq ($(MAKECMDGOALS),wasm)
ifeq ($(RELEASE), 1)
CFLAGS += -Wl,--compress-relocations
endif
endif
# Separate debug and release switches.
ifeq ($(DEBUG), 1)
CFLAGS += -g3
else
@@ -50,7 +64,7 @@ endif
ifeq ($(RELEASE), 1)
CFLAGS += -O3 -fmerge-all-constants -Wl,-O3 \
-ffunction-sections -fdata-sections -Wl,--gc-sections
ifeq ($(ISCLANG), 1)
ifeq ($(CC),clang)
CFLAGS += -Wl,-mllvm,--vectorize-slp=true \
-Wl,-mllvm,--enable-gvn-hoist=true
endif
@@ -66,8 +80,7 @@ wasm:
$(CC) -o player.wasm ./amalgam.c $(CFLAGS)
# todo: Add -mtiny for release without debug
cosmo: CC = ./Cosmo/bin/cosmocc
cosmo: CFLAGS += -I /usr/include/X11 -mclang
cosmo: CFLAGS += -I /usr/include/X11
cosmo: ./amalgam.c
$(CC) $(CFLAGS) -o ./Out/Cosmo/player $^
ifeq ($(RUN), 1)