CSC231 Makefile for linking ASM and C Files

From dftwiki3
Revision as of 20:23, 26 October 2010 by Thiebaut (talk | contribs) (Created page with '--~~~~ ---- =Makefile= <code><pre> CC = gcc LD = gcc NASM = nasm CFLAGS = -c LFLAGS = NASMFLAGS = -f elf -F stabs PROG = hw5test OBJS = asm_io.o $(PROG).o driver.o defa…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut 01:23, 27 October 2010 (UTC)


Makefile

CC = gcc
LD = gcc
NASM = nasm 

CFLAGS =  -c
LFLAGS = 
NASMFLAGS = -f elf -F stabs

PROG = hw5test

OBJS = asm_io.o $(PROG).o driver.o


default: $(PROG)

$(PROG): $(OBJS) 
	$(LD) $(LFLAGS) $(OBJS)  -o $(PROG)

asm_io.o: asm_io.asm
	$(NASM) $(NASMFLAGS) asm_io.asm

$(PROG).o: $(PROG).asm asm_io.inc
	$(NASM) $(NASMFLAGS) $(PROG).asm

driver.o: driver.c 
	$(CC) $(CFLAGS) driver.c

clean:
	rm -rf *.o *~

real_clean:
	 rm -rf *.o $(PROG) *~