PROGRAM=hw8 CC=gcc CFLAGS=-m32 ASM=nasm ASMFLAGS=-f elf default: $(PROGRAM) $(PROGRAM): $(PROGRAM)_ex1.o $(PROGRAM)_ex2.o $(PROGRAM)_ex3.o driver_ex1.o driver_ex2.o driver_ex3.o asm_io.o $(CC) $(CFLAGS) $(PROGRAM)_ex1.o driver_ex1.o asm_io.o -o $(PROGRAM)_ex1 $(CC) $(CFLAGS) $(PROGRAM)_ex2.o driver_ex2.o asm_io.o -o $(PROGRAM)_ex2 $(CC) $(CFLAGS) $(PROGRAM)_ex3.o driver_ex3.o asm_io.o -o $(PROGRAM)_ex3 $(PROGRAM)_ex1.o: $(PROGRAM)_ex1.asm $(ASM) $(ASMFLAGS) $(PROGRAM)_ex1.asm -o $(PROGRAM)_ex1.o $(PROGRAM)_ex2.o: $(PROGRAM)_ex2.asm $(ASM) $(ASMFLAGS) $(PROGRAM)_ex2.asm -o $(PROGRAM)_ex2.o $(PROGRAM)_ex3.o: $(PROGRAM)_ex3.asm $(ASM) $(ASMFLAGS) $(PROGRAM)_ex3.asm -o $(PROGRAM)_ex3.o asm_io.o: asm_io.asm $(ASM) $(ASMFLAGS) -d ELF_TYPE asm_io.asm -o asm_io.o driver_ex1.o: driver_ex1.c $(CC) $(CFLAGS) -c driver_ex1.c -o driver_ex1.o driver_ex2.o: driver_ex2.c $(CC) $(CFLAGS) -c driver_ex2.c -o driver_ex2.o driver_ex3.o: driver_ex3.c $(CC) $(CFLAGS) -c driver_ex3.c -o driver_ex3.o clean: /bin/rm -f *.o $(PROGRAM)_ex1 $(PROGRAM)_ex2 $(PROGRAM)_ex3