File tree Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ dkms.conf
53
53
54
54
# custom
55
55
bin /
56
+ tmp /
56
57
gen_asm.s
57
58
58
59
# Visual Studio noise
@@ -64,4 +65,7 @@ gen_asm.s
64
65
65
66
# Allow our release libraries
66
67
! lib /** /* .lib
67
- ! lib /** /* .a
68
+ ! lib /** /* .a
69
+
70
+ # vs code
71
+ .vscode /
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ CFLAGS += $(NO_CET)
11
11
CXXFLAGS += $(NO_CET )
12
12
13
13
# run c preprocessor with any cflags to get cross compilation result, then run regular compile in native
14
- ABI := $(shell mkdir -p bin; $(CC ) -E $(CFLAGS ) $( CPPFLAGS ) -o bin/get_abi.c get_abi.c && $( CC ) -o bin/get_abi bin/get_abi.c && bin/get_abi )
14
+ ABI := $(shell ./abiname.sh " $(CC ) " " $(CFLAGS ) " )
15
15
ifndef ABI
16
16
$(error Could not determine platform)
17
17
else
34
34
35
35
clean :
36
36
rm -f src/* .o tests/* .o
37
- rm -f bin/*
37
+ rm -f bin/* tmp
38
38
39
39
DEBUG = # -DDEBUG_DUMP
40
40
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # this script compiles and runs src/abiname.c which merely prints
4
+ # out the name of the abi. This can be used by makefiles to identify
5
+ # the correct library path to use to link the library
6
+ # Instead of just compiling and running, we will use the provided compiler
7
+ # and flags to just invoke the pre-processor. We then use the default
8
+ # compiler and linker to compile and link it. This ensures that the
9
+ # script works in cross-compilation environments and can actually
10
+ # run the provided code.
11
+ set -eu
12
+ here=$( dirname " $0 " )
13
+ mkdir -p " ${here} /tmp"
14
+ tmp=$( mktemp " ${here} /tmp/abinameXXX.c" )
15
+
16
+ # 1 create the preprocessed file
17
+ CC=${1:- cc}
18
+ CFLAGS=${2:- }
19
+ ${CC} ${CFLAGS} -E -I " ${here} /src" -o " ${tmp} " " ${here} /src/abiname.c"
20
+ # 2 compile resulting file
21
+ cc -o " ${tmp} .out" " ${tmp} "
22
+ # 3 run it
23
+ " ${tmp} .out"
File renamed without changes.
You can’t perform that action at this time.
0 commit comments