I have an assembler that will not take multiple input files. It takes one .s files and produces a corresponding .o file.
EXECUTABLE_NAME = test.exe
SRC_FILES= \
file1.s \
file2.s
$(EXECUTABLE_NAME) : $(SRC_FILES)
myasm -o file1.o $(SRC_FILES)
mylink -o $(EXECUTABLE_NAME) -s file1.o
How would I modify my makefile to run asm as follows:
myasm -o file1.o file1.s
myasm -o file2.o file2.s
mylink -o $(EXECUTABLE_NAME) -s file1.o file2.o
You need to define a rule that tells nmake how to build your .o from your .s. The syntax is a little gnarly, but something like this:
EXECUTABLE_NAME = test.exe
SRC_FILES= \
file1.s \
file2.s
OBJ_FILES = \
.\file1.o \
.\file2.o
.SUFFIXES : .s
SRC_DIR = .
OBJ_DIR = .
{$(SRC_DIR)}.s{$(OBJ_DIR)}.o:
myasm -o $@ $<
$(EXECUTABLE_NAME) : $(OBJ_FILES)
mylink -o $(EXECUTABLE_NAME) -s $(OBJ_FILES)