diff --git a/src/Makefile b/src/Makefile index 1919287d3..6e4b9880f 100755 --- a/src/Makefile +++ b/src/Makefile @@ -17,6 +17,7 @@ endif # Commands CC = $(Q)arm-none-eabi-gcc +CLANG = $(Q)clang CXX = $(Q)arm-none-eabi-g++ AS = $(Q)arm-none-eabi-as LD = $(Q)arm-none-eabi-ld diff --git a/src/omv/Makefile b/src/omv/Makefile index 5a60bb667..ed6793d30 100644 --- a/src/omv/Makefile +++ b/src/omv/Makefile @@ -109,6 +109,10 @@ SRCS += $(addprefix imlib/, \ SRCS += $(wildcard ports/$(PORT)/*.c) OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) +ifeq ($(USE_CLANG),1) +CLANG_OBJS = $(BUILD)/imlib/bayer.o +endif + OBJ_DIRS = $(sort $(dir $(OBJS))) all: | $(OBJ_DIRS) $(OBJS) @@ -123,6 +127,11 @@ $(BUILD)/%.o : %.s $(ECHO) "AS $<" $(AS) $(AFLAGS) $< -o $@ +# Rule for compiling with clang +$(CLANG_OBJS): $(BUILD)/%.o : %.c + $(ECHO) "CL $<" + $(CLANG) $(CLANG_FLAGS) -c -o $@ $< + $(BUILD)/imlib/fmath.o: override CFLAGS += -fno-strict-aliasing -include $(OBJS:%.o=%.d) diff --git a/src/omv/common/export.mk b/src/omv/common/export.mk index 8cfe6a029..7f5cf1c54 100644 --- a/src/omv/common/export.mk +++ b/src/omv/common/export.mk @@ -11,6 +11,7 @@ # Export Commands export Q export CC +export CLANG export CXX export AS export LD