OpenBSD has no uuid, bring it with us
This commit is contained in:
parent
b16dcbdc02
commit
2b2ca1baf5
23
Makefile
23
Makefile
@ -18,11 +18,17 @@
|
|||||||
|
|
||||||
ifeq ($(shell uname),OpenBSD)
|
ifeq ($(shell uname),OpenBSD)
|
||||||
GCC:= egcc
|
GCC:= egcc
|
||||||
|
DEPS:= $(GCC) clang ./uuid
|
||||||
|
ifndef MKUUID
|
||||||
|
MKUUID!= $(shell $(MAKE) uuid)
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
GCC:= gcc
|
GCC:= gcc
|
||||||
|
DEPS:= $(GCC) clang uuid lld
|
||||||
|
LDFLAGS+= -fuse-ld=lld
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXECUTABLES= clang $(GCC) uuid lld
|
EXECUTABLES= $(DEPS)
|
||||||
XXXX:= $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec) 2> /dev/null),X,$(error "No '$(exec)' in PATH, please install it and restart octopus !")))
|
XXXX:= $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec) 2> /dev/null),X,$(error "No '$(exec)' in PATH, please install it and restart octopus !")))
|
||||||
|
|
||||||
### Generic flags
|
### Generic flags
|
||||||
@ -33,13 +39,12 @@ CFLAGS+= -Wall
|
|||||||
CFLAGS+= -Werror -Wextra
|
CFLAGS+= -Werror -Wextra
|
||||||
CFLAGS+= -Wno-unused-parameter
|
CFLAGS+= -Wno-unused-parameter
|
||||||
CFLAGS+= -Wno-missing-field-initializers
|
CFLAGS+= -Wno-missing-field-initializers
|
||||||
LDFLAGS= -fuse-ld=lld
|
|
||||||
|
|
||||||
### Octopus flags
|
### Octopus flags
|
||||||
CCS= clang $(GCC)
|
CCS= clang $(GCC)
|
||||||
OPTIMIZATIONS= 0 1 2 3 fast s
|
OPTIMIZATIONS= 0 1 2 3 fast s
|
||||||
RETPOLINE= mretpoline
|
RETPOLINE= mretpoline
|
||||||
UUID:= $(shell uuid || uuidgen)
|
UUID:= $(shell uuid || uuidgen || ./uuid)
|
||||||
RESULTS_FILE:= results-$(UUID).json
|
RESULTS_FILE:= results-$(UUID).json
|
||||||
SSH_KEY= octoupload
|
SSH_KEY= octoupload
|
||||||
TIMES= 3
|
TIMES= 3
|
||||||
@ -47,18 +52,21 @@ OCTOFLAGS= -j
|
|||||||
|
|
||||||
### Octopus internals
|
### Octopus internals
|
||||||
CPU:= $(shell LC_ALL=en_US.UTF-8 lscpu | grep "Model name" | cut -d":" -f 2 | sort | uniq | awk '{$$1=$$1;print}')
|
CPU:= $(shell LC_ALL=en_US.UTF-8 lscpu | grep "Model name" | cut -d":" -f 2 | sort | uniq | awk '{$$1=$$1;print}')
|
||||||
UCODE:= $(shell grep microcode /proc/cpuinfo | sort | uniq | awk '{print $$NF}' || printf none)
|
UCODE:= $(shell (grep microcode /proc/cpuinfo || printf unknown) | sort | uniq | awk '{print $$NF}' || printf unknown)
|
||||||
KERN:= $(shell uname -svm)
|
KERN:= $(shell uname -svm)
|
||||||
CLANGV:= $(shell clang -v 2>&1 | head -n 1)
|
CLANGV:= $(shell clang -v 2>&1 | head -n 1)
|
||||||
GCCV:= $(shell gcc -v 2>&1 | grep 'gcc version')
|
GCCV:= $(shell gcc -v 2>&1 | grep 'gcc version')
|
||||||
VULN1:= $(shell cat /sys/devices/system/cpu/vulnerabilities/spectre_v1)
|
VULN1:= $(shell (cat /sys/devices/system/cpu/vulnerabilities/spectre_v1 || printf unknown))
|
||||||
VULN2:= $(shell cat /sys/devices/system/cpu/vulnerabilities/spectre_v2)
|
VULN2:= $(shell (cat /sys/devices/system/cpu/vulnerabilities/spectre_v2 || printf unknown))
|
||||||
|
|
||||||
|
|
||||||
|
ifneq ($(shell uname),OpenBSD)
|
||||||
ifndef PROGRESS
|
ifndef PROGRESS
|
||||||
HIT_TOTAL!= $(MAKE) $(MAKECMDGOALS) --dry-run PROGRESS="HIT_MARK" | grep -c "HIT_MARK"
|
HIT_TOTAL!= $(MAKE) $(MAKECMDGOALS) --dry-run PROGRESS="HIT_MARK" | grep -c "HIT_MARK"
|
||||||
HIT_COUNT= $(eval HIT_N != expr $(HIT_N) + 1)$(HIT_N)
|
HIT_COUNT= $(eval HIT_N != expr $(HIT_N) + 1)$(HIT_N)
|
||||||
PROGRESS= echo "[`expr $(HIT_COUNT) '*' 100 / $(HIT_TOTAL)`%]"
|
PROGRESS= echo "[`expr $(HIT_COUNT) '*' 100 / $(HIT_TOTAL)`%]"
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
SUB_ONE= $(word 1, $(subst -, ,$@))
|
SUB_ONE= $(word 1, $(subst -, ,$@))
|
||||||
SUB_TWO= $(word 2, $(subst -, ,$@))
|
SUB_TWO= $(word 2, $(subst -, ,$@))
|
||||||
@ -212,5 +220,8 @@ $(RSGPROGS):
|
|||||||
@$(PROGRESS) $(SUB_TWO) $(addprefix -, $(SUB_FOUR)) $(CFLAGS) -mfunction-return=thunk -mindirect-branch=thunk -mindirect-branch-register -$(SUB_THREE) -o $@ $(SUB_ONE).c
|
@$(PROGRESS) $(SUB_TWO) $(addprefix -, $(SUB_FOUR)) $(CFLAGS) -mfunction-return=thunk -mindirect-branch=thunk -mindirect-branch-register -$(SUB_THREE) -o $@ $(SUB_ONE).c
|
||||||
$(SUB_TWO) $(addprefix -, $(SUB_FOUR)) $(CFLAGS) -mfunction-return=thunk -mindirect-branch=thunk -mindirect-branch-register -$(SUB_THREE) -o $@ $(SUB_ONE).c
|
$(SUB_TWO) $(addprefix -, $(SUB_FOUR)) $(CFLAGS) -mfunction-return=thunk -mindirect-branch=thunk -mindirect-branch-register -$(SUB_THREE) -o $@ $(SUB_ONE).c
|
||||||
|
|
||||||
|
uuid:
|
||||||
|
$(CC) -o $@ uuid.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(PROGS) *.json
|
rm -rf $(PROGS) *.json
|
||||||
|
Loading…
Reference in New Issue
Block a user