How to transfer a C file to a C ++ file?

I have the following legacy make file.
How to update this file to compile C ++?
Here is the dependency section:

# Dependency rules

.PHONY: all clean

all: $(TARGET)_$(JENNIC_CHIP)$(BIN_SUFFIX).bin

-include $(APPDEPS)
%.d:
    rm -f $*.o

%.o: %.S
    $(info Assembling $< ...)
    $(CC) -c -o $@ $(CFLAGS) $(INCFLAGS) $< -MD -MF $*.d -MP
    @echo

%.o: %.c 
    $(info Compiling $< ...)
    $(CC) -c -o $@ $(CFLAGS) $(INCFLAGS) $< -MD -MF $*.d -MP
    @echo

$(TARGET)_$(JENNIC_CHIP)$(BIN_SUFFIX).elf: $(APPOBJS) $(addsuffix _$(JENNIC_CHIP_FAMILY).a,$(addprefix $(COMPONENTS_BASE_DIR)/Library/lib,$(APPLIBS))) 
    $(info Linking $@ ...)
    $(CC) -Wl,--gc-sections -Wl,-u_AppColdStart -Wl,-u_AppWarmStart $(LDFLAGS) -T$(LINKCMD) -o $@ $(APPOBJS) -Wl,--start-group $(addprefix -l,$(LDLIBS)) -Wl,--end-group -Wl,-Map,$(TARGET)_$(JENNIC_CHIP)$(BIN_SUFFIX).map 
    ba-elf-size $@
    @echo

$(TARGET)_$(JENNIC_CHIP)$(BIN_SUFFIX).bin: $(TARGET)_$(JENNIC_CHIP)$(BIN_SUFFIX).elf 
    $(info Generating binary ...)
    $(OBJCOPY) -S -O binary $< $@

It compiles some C codes for micro.

+4
source share
1 answer

I think you are changing your CC from gcc to g ++.

-1
source

All Articles