Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag

# GD32VF103 Linker Script:
LDFLAGS += -T../device/gd32vf103xb.ld

# Source files:
AS_SRC  = ../device/gd32vf103xb_boot.S
C_SRC   = main.c
C_SRC  += ../device/n200_func.c

# Header file directories:
INCLUDE = -I../device/include

# Object files to build:
OBJS  = $(AS_SRC:.S=.o)
OBJS += $(C_SRC:.c=.o)

# Default rule to build the whole project:
.PHONY: all
all: main.bin

# Rule to build assembly files:
%.o: %.S
	$(CC) -x assembler-with-cpp -c $(CFLAGS) $(INCLUDE) $< -o $@

# Rule to compile C files:
%.o: %.c
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@

# Rule to create an ELF file from the compiled object files:
main.elf: $(OBJS)
	$(CC) $^ $(LDFLAGS) -o $@

# Rule to create a raw binary file from an ELF file:
main.bin: main.elf
	$(OBJCOPY) -S -O binary $< $@
	$(SIZE) $<

# Rule to clear out generated build files:
.PHONY: clean
clean:
	rm -f $(OBJS)
	rm -f main.elf
	rm -f main.bin