Makefiles
Adrian Carpenter (10173) 16 posts |
I am moving my project to Makefiles, I’ve never really used them before as I use either native development tools systems or CMake, so I’ve avoided ever really having to use them apart from in very simple cases. I’m having issues with C++ sources though, no matter what I try it runs C++ every time even if nothing is changed, it runs the C++ tool for each fine in the program. It must be something I’m doing (or not doing) but I can’t seem to figure out what. I’ve attached the snippets of the Makefile in question, it should be noted that for assembly files it’s working fine, if they haven’t changed it doesn’t reassemble. Running amu with -D shows it saying “o.lzw is out of date w.r.t to c++.lzw”, this repeats for all files that are linked into the executable. Maybe I’ve missed something obvious, but I can’t see any differences against AS which does work. Helpfully the forum doesn’t mangle the code. IMAGETOOL_SOURCES := c++.hash c++.lzw c++.imager c++.imagetool c++.throwback IMAGETOOL_TARGET := bin.imagetool IMAGETOOL_OBJECTS := $(patsubst c++.%, o.%, ${IMAGETOOL_SOURCES}) DIRS := o._dirs CLIBS := C:C++Lib.o.c++lib CLIB:o.stubs CXXFLAGS := -c -throwback ASFLAGS := -now -throwback WFLAGS := FR~C~V ABS_LDFLAGS := -c++ # The following tools are used/required by the build process. AS := objasm CXX := c++ LD := link DO := DO MKDIR := ${DO} mkdir -p XWIPE := x wipe WIPE := ${XWIPE} TOUCH := Touch ECHO := echo # Our make targets. all: ${IMAGETOOL_TARGET} ${DIRS} tools: ${IMAGETOOL_TARGET} ${DIRS} clean:: @IfThere o Then ${ECHO} ${WIPE} o ${WFLAGS} @IfThere o Then ${WIPE} o ${WFLAGS} @IfThere rm Then ${ECHO} ${WIPE} rm ${WFLAGS} @IfThere rm Then ${WIPE} rm ${WFLAGS} @IfThere rom Then ${ECHO} ${WIPE} rom ${WFLAGS} @IfThere rom Then ${WIPE} rom ${WFLAGS} @IfThere bin Then ${ECHO} ${WIPE} bin ${WFLAGS} @IfThere bin Then ${WIPE} bin ${WFLAGS} @IfThere data Then ${ECHO} ${WIPE} data ${WFLAGS} @IfThere data Then ${WIPE} data ${WFLAGS} ${DIRS} :: @${MKDIR} o @${MKDIR} rm @${MKDIR} rom @${MKDIR} bin @${MKDIR} data @${TOUCH} $@ ${IMAGETOOL_TARGET}: $(IMAGETOOL_OBJECTS) ${LD} ${ABS_LDFLAGS} -o $@ ${CLIBS} ${IMAGETOOL_OBJECTS} .SUFFIXES: .o .s .c++ .h .s.o: @${AS} ${ASFLAGS} -o $@ $< .c++.o: @${CXX} ${CXXFLAGS} -o $@ $< |
Adrian Carpenter (10173) 16 posts |
Ok, as always the minute I post something I’ve been struggling with for a few hours, I find something. I’m currently using RPCEMU and I think this is either related to macOS or RPCEMU’s HostFS under macOS, I restarted RPCEMU and then amu started behaving correctly again, the now running amu I get a nothing to do message. |
Chris Mahoney (1684) 2165 posts |
I’d suggest that you try to get your head around the “shared makefiles”. Most of what you have there can be simplified down to the following. A change or two might be required, but they really do get rid of a lot of the repetition. COMPONENT = imagetool OBJS = hash lzw imager imagetool throwback LINK_TYPE = C++ include CApp Edit: Extra line |
Sprow (202) 1155 posts |
You can even trim the |
Chris Mahoney (1684) 2165 posts |
Good to know. It must’ve been there in the example I originally copied :) |