Difference between revisions of "CSC231 Lab 7 2010"
(→Problem #1: Pascal's Triangle with Functions) |
(→Problem #1: Pascal's Triangle with Functions) |
||
Line 8: | Line 8: | ||
** [[CSC231 driver.c | driver.c]] | ** [[CSC231 driver.c | driver.c]] | ||
** [[CSC231 Lab7skel.asm | lab7skel.asm ]], a skeleton program that will eventually contain your code | ** [[CSC231 Lab7skel.asm | lab7skel.asm ]], a skeleton program that will eventually contain your code | ||
+ | |||
+ | * Use a Makefile to make your executable. Call it '''Makefile''' with an uppercase '''M'''. | ||
+ | |||
+ | |||
+ | <code><pre> | ||
+ | CC = gcc | ||
+ | LD = gcc | ||
+ | NASM = nasm | ||
+ | |||
+ | CFLAGS = -c | ||
+ | LFLAGS = | ||
+ | NASMFLAGS = -f elf -F stabs | ||
+ | |||
+ | PROG = lab7 | ||
+ | |||
+ | 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) *~ | ||
+ | |||
+ | </pre></code> | ||
+ | |||
+ | :''Note'': In Makefiles, make sure that the lines that do not start at the left-most margin start with a '''Tab''' character, not a space. |
Revision as of 08:45, 5 November 2010
--D. Thiebaut 13:37, 5 November 2010 (UTC)
Problem #1: Pascal's Triangle with Functions
- Use the same setup as for Homework 5. In particular you will need
- asm_io.asm
- asm_io.inc
- driver.c
- lab7skel.asm , a skeleton program that will eventually contain your code
- Use a Makefile to make your executable. Call it Makefile with an uppercase M.
CC = gcc
LD = gcc
NASM = nasm
CFLAGS = -c
LFLAGS =
NASMFLAGS = -f elf -F stabs
PROG = lab7
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) *~
- Note: In Makefiles, make sure that the lines that do not start at the left-most margin start with a Tab character, not a space.