From: David L. <yak...@ya...> - 2009-10-04 07:35:37
|
> > > > .obj/%.o : %.c $(PRJ_HEAD) > > @-mkdir -p $(dir $@) > > $(CC) $(CC_FLAGS) -c $< -o $@ Calling the shell at every source file just to try to make the destination directory is very inefficient. You should make a "prepare" rule that just creates everything that is needed. By the way, for the linker, I just use a file like this: -- -m -j -x -i /home/yakumo/dev/prj/msx/sdk/build/demos/testmake/bin/testmake -b _CODE = 0x4020 -b _DATA = 0x8000 -k /usr/local/share/sdcc/lib/z80 -l z80 /home/yakumo/dev/prj/msx/sdk/build/libraries/startup/bin/crt0msx_rom.o /home/yakumo/dev/prj/msx/sdk/build/demos/testmake/obj/psg.o /home/yakumo/dev/prj/msx/sdk/build/demos/testmake/obj/debug.o /home/yakumo/dev/prj/msx/sdk/build/demos/testmake/obj/main.o /home/yakumo/dev/prj/msx/sdk/build/demos/testmake/obj/psgasm.o /home/yakumo/dev/prj/msx/sdk/build/demos/testmake/obj/test.o -l z80.lib Then in the linking rule I use: $(BIN_DIR_POSIX)/$(TARGET_NAME).ihx: $(OBJ_FILES_FULL_POSIX) @echo -n; \ echo -Creating link file; \ echo -- > $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo -m >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo -j >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo -x >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo -i '$(BIN_DIR_POSIX)/$(TARGET_NAME)' >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo -b _CODE = $(CODE_LOC) >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo -b _DATA = $(DATA_LOC) >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo "-k $(COMPILER_LIB_PATH)" >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo -l z80 >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo '$(STARTUP_DIR_POSIX)/bin/$(STARTUP_CODE_FILENAME)' >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ for file in $(OBJ_FILES_FULL_POSIX); do \ echo $$file >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ done; \ echo "-l z80.lib" >> $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; \ echo -Linking; \ $(LD) $(LDFLAGS) -f $(BIN_DIR_POSIX)/$(TARGET_NAME).lnk; As you can see in the target I create the link file, and specify it through the -f parameter. Regards. |