Makefile 895 B

123456789101112131415161718192021222324252627282930313233
  1. CC=clang
  2. BIT_INT_FLAGS=-Xclang -fexperimental-max-bitint-width=512
  3. CFLAGS=$(TARGET_FLAGS) -emit-llvm -O3 -ffreestanding -fno-builtin -Wall -Wno-unused-function $(BIT_INT_FLAGS)
  4. ../target/bpf/%.bc: %.c
  5. $(CC) -c $(CFLAGS) $< -o $@
  6. ../target/wasm/%.bc: %.c
  7. $(CC) -c $(CFLAGS) $< -o $@
  8. SOLANA=$(addprefix ../target/bpf/,solana.bc bigint.bc format.bc stdlib.bc ripemd160.bc heap.bc)
  9. WASM=$(addprefix ../target/wasm/,ripemd160.bc stdlib.bc bigint.bc format.bc heap.bc soroban.bc)
  10. all: $(SOLANA) $(WASM)
  11. $(SOLANA) $(WASM): | outputs_dirs
  12. $(SOLANA): TARGET_FLAGS=--target=sbf
  13. $(WASM): TARGET_FLAGS=--target=wasm32
  14. bpf/solana.bc: solana.c solana_sdk.h | outputs_dirs
  15. outputs_dirs:
  16. @mkdir -p ../target/bpf ../target/wasm
  17. clean:
  18. rm -rf ../target/bpf ../target/wasm
  19. test:
  20. clang -DTEST -DSOL_TEST -O3 -Wall solana.c stdlib.c -o test
  21. lint:
  22. clang-format *.c *.h --style=file --dry-run -Werror