Skip to content

Commit

Permalink
Don't hard-code GCC in Makefile
Browse files Browse the repository at this point in the history
This uses the `CC` variable (which defaults to `cc`) so that compilation
works when using Clang. This also allows the compiler to be overridden
via `CC=foo make`.
  • Loading branch information
Et7f3 authored Jun 14, 2024
1 parent ba35af5 commit 575d865
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ osim: ocaml_emulator/riscv_ocaml_sim_$(ARCH)
rvfi: c_emulator/riscv_rvfi_$(ARCH)

c_emulator/riscv_sim_$(ARCH): generated_definitions/c/riscv_model_$(ARCH).c $(C_INCS) $(C_SRCS) $(SOFTFLOAT_LIBS) Makefile
gcc -g $(C_WARNINGS) $(C_FLAGS) $< $(C_SRCS) $(SAIL_LIB_DIR)/*.c $(C_LIBS) -o $@
$(CC) -g $(C_WARNINGS) $(C_FLAGS) $< $(C_SRCS) $(SAIL_LIB_DIR)/*.c $(C_LIBS) -o $@

# Note: We have to add -c_preserve since the functions might be optimized out otherwise
rvfi_preserve_fns=-c_preserve rvfi_set_instr_packet \
Expand All @@ -304,7 +304,7 @@ generated_definitions/c/riscv_rvfi_model_$(ARCH).c: $(SAIL_RVFI_SRCS) model/main
mv $@.new $@

c_emulator/riscv_rvfi_$(ARCH): generated_definitions/c/riscv_rvfi_model_$(ARCH).c $(C_INCS) $(C_SRCS) $(SOFTFLOAT_LIBS) Makefile
gcc -g $(C_WARNINGS) $(C_FLAGS) $< -DRVFI_DII $(C_SRCS) $(SAIL_LIB_DIR)/*.c $(C_LIBS) -o $@
$(CC) -g $(C_WARNINGS) $(C_FLAGS) $< -DRVFI_DII $(C_SRCS) $(SAIL_LIB_DIR)/*.c $(C_LIBS) -o $@

latex: $(SAIL_SRCS) Makefile
mkdir -p generated_definitions/latex
Expand Down
2 changes: 1 addition & 1 deletion c_emulator/SoftFloat-3e/build/Linux-RISCV-GCC/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SOFTFLOAT_OPTS ?= \
DELETE = rm -f
C_INCLUDES = -I. -I$(SOURCE_DIR)/$(SPECIALIZE_TYPE) -I$(SOURCE_DIR)/include
COMPILE_C = \
gcc -c -Werror-implicit-function-declaration \
$(CC) -c -Werror-implicit-function-declaration \
$(SOFTFLOAT_OPTS) $(C_INCLUDES) -O2 -o $@
MAKELIB = ar crs $@

Expand Down

0 comments on commit 575d865

Please sign in to comment.