mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Tidy up makefiles a bit more
This commit is contained in:
parent
92ac33c2df
commit
3bfec7b607
6 changed files with 77 additions and 33 deletions
|
@ -25,10 +25,9 @@ INCLUDES := third_party/bearssl/inc
|
|||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
|
|
|
@ -18,19 +18,41 @@ SOURCE_DIR := src
|
|||
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
|
||||
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
|
||||
|
||||
$(TARGET).bin $(TARGET).APPL $(TARGET).dsk: $(BUILD_DIR) $(TARGET).code.bin
|
||||
# Dependency tracking
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||
DEPFILES := $(C_OBJECTS:%.o=%.d)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
default: $(BUILD_DIR) $(TARGET).bin
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# executable generation
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).bin $(TARGET).APPL $(TARGET).dsk: $(TARGET).code.bin
|
||||
$(REZ) $(REZFLAGS) \
|
||||
--copy "$(TARGET).code.bin" \
|
||||
"misc/macclassic/68APPL.r" \
|
||||
-t "APPL" -c "????" \
|
||||
-o $(TARGET).bin --cc $(TARGET).APPL --cc $(TARGET).dsk
|
||||
|
||||
|
||||
$(TARGET).code.bin: $(C_OBJECTS)
|
||||
$(CC) $(C_OBJECTS) -o $@ $(LDFLAGS)
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# object generation
|
||||
#---------------------------------------------------------------------------------
|
||||
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||
|
||||
# Dependency tracking
|
||||
$(DEPFILES):
|
||||
|
||||
include $(wildcard $(DEPFILES))
|
||||
|
|
|
@ -19,7 +19,24 @@ SOURCE_DIR := src
|
|||
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
|
||||
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
|
||||
|
||||
$(TARGET).bin $(TARGET).APPL $(TARGET).dsk: $(BUILD_DIR) $(TARGET).pef
|
||||
# Dependency tracking
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||
DEPFILES := $(C_OBJECTS:%.o=%.d)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
default: $(BUILD_DIR) $(TARGET).bin
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# executable generation
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).bin $(TARGET).APPL $(TARGET).dsk: $(TARGET).pef
|
||||
$(REZ) $(REZFLAGS) \
|
||||
"misc/macclassic/ppcAPPL.r" \
|
||||
-t "APPL" -c "????" \
|
||||
|
@ -35,5 +52,14 @@ $(TARGET).pef: $(TARGET).elf
|
|||
$(BUILD_DIR):
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# object generation
|
||||
#---------------------------------------------------------------------------------
|
||||
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||
|
||||
# Dependency tracking
|
||||
$(DEPFILES):
|
||||
|
||||
include $(wildcard $(DEPFILES))
|
||||
|
|
|
@ -75,43 +75,39 @@ export INCLUDE := -I$(LIBXENON_INC)
|
|||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := -L$(LIBXENON_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf32: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
default: $(BUILD) $(TARGET).elf32
|
||||
|
||||
default: $(BUILD) $(OUTPUT).elf32
|
||||
cp $(OUTPUT).elf32 /tftpboot/xenon
|
||||
xenon-strip /tftpboot/xenon
|
||||
$(TARGET).elf32: $(TARGET).elf
|
||||
$(TARGET).elf: $(OFILES)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
[ -d $@ ] || mkdir -p $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).elf32
|
||||
echo clean ...
|
||||
rm -fr $(BUILD) $(TARGET).elf $(TARGET).elf32
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.c
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.s
|
||||
@$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
@$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
%.elf:
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -n -T $(LDSCRIPT) -o $@
|
||||
echo linking ... $(notdir $@)
|
||||
$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -n -T $(LDSCRIPT) -o $@
|
||||
|
||||
%.elf32: %.elf
|
||||
@echo converting and stripping ... $(notdir $@)
|
||||
@xenon-objcopy -O elf32-powerpc --adjust-vma 0x80000000 $< $@
|
||||
@xenon-strip $@
|
||||
echo converting and stripping ... $(notdir $@)
|
||||
xenon-objcopy -O elf32-powerpc --adjust-vma 0x80000000 $< $@
|
||||
xenon-strip $@
|
||||
|
|
|
@ -214,7 +214,6 @@ int File_Exists(const cc_string* path) {
|
|||
cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCallback callback) {
|
||||
cc_string path; char pathBuffer[FILENAME_SIZE];
|
||||
cc_filepath str;
|
||||
int res;
|
||||
// CD filesystem loader doesn't usually set errno
|
||||
// when it can't find the requested file
|
||||
errno = 0;
|
||||
|
@ -544,8 +543,11 @@ static void InitSDCard(void) {
|
|||
}
|
||||
|
||||
root_path = String_FromReadonly("/sd/ClassiCube/");
|
||||
fs_mkdir("/sd/ClassiCube");
|
||||
Platform_ReadonlyFilesystem = false;
|
||||
|
||||
cc_filepath* root = FILEPATH_RAW("/sd/ClassiCube");
|
||||
int res = Directory_Create(root);
|
||||
Platform_Log1("ROOT DIRECTORY CREATE %i", &res);
|
||||
}
|
||||
|
||||
static void InitModem(void) {
|
||||
|
|
|
@ -680,10 +680,9 @@ void Platform_Init(void) {
|
|||
Networking_Init();
|
||||
Networking_Setup();
|
||||
|
||||
// Create root directory
|
||||
cc_filepath* root = FILEPATH_RAW("mass:/ClassiCube");
|
||||
int res = Directory_Create(root);
|
||||
Platform_Log1("ROOT CREATE %i", &res);
|
||||
Platform_Log1("ROOT DIRECTORY CREATE %i", &res);
|
||||
}
|
||||
|
||||
void Platform_Free(void) { }
|
||||
|
|
Loading…
Reference in a new issue