From: "John S. Fine" Newsgroups: comp.os.msdos.djgpp Subject: Re: Making MAKE call NASM like it calls GCC Date: Fri, 25 Sep 1998 10:35:43 -0400 Lines: 42 Message-ID: <360BAA3F.79D6@erols.com> References: Reply-To: johnfine AT erols DOT com NNTP-Posting-Host: 207-172-243-164.s37.as9.bsd.erols.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit CC: rylan AT intekom DOT co DOT za To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk George Foot wrote: > > On 25 Sep 98 at 11:01, Rylan wrote: > > gal.exe: $(OBJ); \ > > $(CC) -o gal.exe $(OBJ) -lalleg -lseal -m486 -s -Wall -Werror . . . > You misunderstood what Make did. Calling gcc to compile .c > files into .o files was done automatically -- nothing to do > with the rule you posted above. In case that needs to be a little clearer, the source of the confusion is that gcc is used as both the compiler and the linker (actually gcc is a control program that invokes the compiler and linker). The rule above, is using gcc as a linker to combine all the .o files (and some libraries) into an exe file. As such, its list of .o files must include both the ones that came from .c files and the ones that came from .asm files. > I don't know how to call NASM, but supposing it takes `-i' to > specify the input file and `-o' to specify the output file, and > `-switches' are the switches to use, e.g.: > > nasm -i input.asm -o output.o -switches > > You could put: > > %.o: %.asm > nasm -i $< -o $@ -switches The input file is given bare (without a switch, just like .c files for gcc). "-fcoff" is required to tell it that the output format is a djgpp compatible .o file. Other switches might be helpful depending on what you are doing. nasm $< -o $@ -fcoff $(NASMFLAGS) -- http://www.erols.com/johnfine/ http://www.geocities.com/SiliconValley/Peaks/8600/