File tree 4 files changed +31
-4
lines changed
4 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 45
45
46
46
# custom
47
47
bin /
48
+ tmp /
48
49
gen_asm.s
49
50
50
51
# Visual Studio noise
@@ -56,4 +57,7 @@ gen_asm.s
56
57
57
58
# Allow our release libraries
58
59
! lib /** /* .lib
59
- ! lib /** /* .a
60
+ ! lib /** /* .a
61
+
62
+ # vs code
63
+ .vscode /
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ LD = $(PLATFORM_PREFIX)ld
18
18
AR = $(PLATFORM_PREFIX ) ar
19
19
endif
20
20
# run c preprocessor with any cflags to get cross compilation result, then run regular compile in native
21
- ABI := $(shell set -x; mkdir -p bin; $(CC ) -E $(CFLAGS ) $( CPPFLAGS ) -o bin/get_abi.c get_abi.c && $( OLDCC ) -o bin/get_abi bin/get_abi.c && bin/get_abi )
21
+ ABI := $(shell ./abiname.sh " $(CC ) " " $(CFLAGS ) " )
22
22
ifndef ABI
23
23
$(error Could not determine platform)
24
24
else
@@ -37,11 +37,11 @@ $(LIB)/libstackman.a: lib $(obj)
37
37
38
38
.PHONY : lib clean
39
39
lib :
40
- mkdir -p $(LIB )
40
+ mkdir -p $(LIB ) bin
41
41
42
42
clean :
43
43
rm -f src/* .o tests/* .o
44
- rm -f bin/*
44
+ rm -f bin/* tmp
45
45
46
46
DEBUG = # -DDEBUG_DUMP
47
47
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