Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. # use normal make for this Makefile
  2. #
  3. # Makefile for building user programs to run on top of Nachos
  4. #
  5. # Several things to be aware of:
  6. #
  7. # Nachos assumes that the location of the program startup routine (the
  8. # location the kernel jumps to when the program initially starts up)
  9. # is at location 0. This means: start.o must be the first .o passed
  10. # to ld, in order for the routine "Start" to be loaded at location 0
  11. #
  12.  
  13. # if you are cross-compiling, you need to point to the right executables
  14. # and change the flags to ld and the build procedure for as
  15.  
  16. GCCDIR = ../../../gnu-decstation-ultrix/decstation-ultrix/2.95.3/
  17.  
  18. LDFLAGS = -T script -N
  19. ASFLAGS = -mips2
  20. CPPFLAGS = $(INCDIR)
  21.  
  22. # if you aren't cross-compiling:
  23. # GCCDIR =
  24. # LDFLAGS = -N -T 0
  25. # ASFLAGS =
  26. # CPPFLAGS = -P $(INCDIR)
  27.  
  28. PATH = $(GCCDIR):/lib:/usr/bin:/bin
  29.  
  30. CC = $(GCCDIR)gcc -B../../../gnu-decstation-ultrix/
  31. AS = $(GCCDIR)as
  32. LD = $(GCCDIR)ld
  33.  
  34. CPP = gcc -E
  35. INCDIR =-I../userprog -I../threads
  36. CFLAGS = -G 0 -c $(INCDIR)
  37.  
  38. # Them ten file muon bien dich sau 'all'
  39.  
  40. all: halt shell matmult sort PrintInt ReadInt ReadChar PrintChar PrintString ReadString Ascii Help cmain cat echo Create copy reverse
  41.  
  42. start.o: start.s ../userprog/syscall.h
  43. $(CPP) $(CPPFLAGS) start.c > strt.s
  44. $(AS) $(ASFLAGS) -o start.o strt.s
  45. rm strt.s
  46.  
  47. halt.o: halt.c
  48. $(CC) $(CFLAGS) -c halt.c
  49. halt: halt.o start.o
  50. $(LD) $(LDFLAGS) start.o halt.o -o halt.coff
  51. ../bin/coff2noff halt.coff halt
  52.  
  53. shell.o: shell.c
  54. $(CC) $(CFLAGS) -c shell.c
  55. shell: shell.o start.o
  56. $(LD) $(LDFLAGS) start.o shell.o -o shell.coff
  57. ../bin/coff2noff shell.coff shell
  58.  
  59. sort.o: sort.c
  60. $(CC) $(CFLAGS) -c sort.c
  61. sort: sort.o start.o
  62. $(LD) $(LDFLAGS) start.o sort.o -o sort.coff
  63. ../bin/coff2noff sort.coff sort
  64.  
  65. matmult.o: matmult.c
  66. $(CC) $(CFLAGS) -c matmult.c
  67. matmult: matmult.o start.o
  68. $(LD) $(LDFLAGS) start.o matmult.o -o matmult.coff
  69. ../bin/coff2noff matmult.coff matmult
  70.  
  71. # Them lenh tao file thuc thi ma may .coff tu file .c sau khi he thong bien dich thanh cong
  72.  
  73. ReadInt.o: ReadInt.c
  74. $(CC) $(CFLAGS) -c ReadInt.c
  75. ReadInt: ReadInt.o start.o
  76. $(LD) $(LDFLAGS) start.o ReadInt.o -o ReadInt.coff
  77. ../bin/coff2noff ReadInt.coff ReadInt
  78.  
  79. PrintInt.o: PrintInt.c
  80. $(CC) $(CFLAGS) -c PrintInt.c
  81. PrintInt: PrintInt.o start.o
  82. $(LD) $(LDFLAGS) start.o PrintInt.o -o PrintInt.coff
  83. ../bin/coff2noff PrintInt.coff PrintInt
  84.  
  85. ReadChar.o: ReadChar.c
  86. $(CC) $(CFLAGS) -c ReadChar.c
  87. ReadChar: ReadChar.o start.o
  88. $(LD) $(LDFLAGS) start.o ReadChar.o -o ReadChar.coff
  89. ../bin/coff2noff ReadChar.coff ReadChar
  90.  
  91. PrintChar.o: PrintChar.c
  92. $(CC) $(CFLAGS) -c PrintChar.c
  93. PrintChar: PrintChar.o start.o
  94. $(LD) $(LDFLAGS) start.o PrintChar.o -o PrintChar.coff
  95. ../bin/coff2noff PrintChar.coff PrintChar
  96.  
  97. ReadString.o: ReadString.c
  98. $(CC) $(CFLAGS) -c ReadString.c
  99. ReadString: ReadString.o start.o
  100. $(LD) $(LDFLAGS) start.o ReadString.o -o ReadString.coff
  101. ../bin/coff2noff ReadString.coff ReadString
  102.  
  103. PrintString.o: PrintString.c
  104. $(CC) $(CFLAGS) -c PrintString.c
  105. PrintString: PrintString.o start.o
  106. $(LD) $(LDFLAGS) start.o PrintString.o -o PrintString.coff
  107. ../bin/coff2noff PrintString.coff PrintString
  108.  
  109. Ascii.o: Ascii.c
  110. $(CC) $(CFLAGS) -c Ascii.c
  111. Ascii: Ascii.o start.o
  112. $(LD) $(LDFLAGS) start.o Ascii.o -o Ascii.coff
  113. ../bin/coff2noff Ascii.coff Ascii
  114.  
  115. Help.o: Help.c
  116. $(CC) $(CFLAGS) -c Help.c
  117. Help: Help.o start.o
  118. $(LD) $(LDFLAGS) start.o Help.o -o Help.coff
  119. ../bin/coff2noff Help.coff Help
  120.  
  121. cmain.o: cmain.c
  122. $(CC) $(CFLAGS) -c cmain.c
  123. cmain: cmain.o start.o
  124. $(LD) $(LDFLAGS) start.o cmain.o -o cmain.coff
  125. ../bin/coff2noff cmain.coff cmain
  126.  
  127. cat.o: cat.c
  128. $(CC) $(CFLAGS) -c cat.c
  129. cat: cat.o start.o
  130. $(LD) $(LDFLAGS) start.o cat.o -o cat.coff
  131. ../bin/coff2noff cat.coff cat
  132.  
  133. echo.o: echo.c
  134. $(CC) $(CFLAGS) -c echo.c
  135. echo: echo.o start.o
  136. $(LD) $(LDFLAGS) start.o echo.o -o echo.coff
  137. ../bin/coff2noff echo.coff echo
  138.  
  139. Create.o: Create.c
  140. $(CC) $(CFLAGS) -c Create.c
  141. Create: Create.o start.o
  142. $(LD) $(LDFLAGS) start.o Create.o -o Create.coff
  143. ../bin/coff2noff Create.coff Create
  144.  
  145. reverse.o: reverse.c
  146. $(CC) $(CFLAGS) -c reverse.c
  147. reverse: reverse.o start.o
  148. $(LD) $(LDFLAGS) start.o reverse.o -o reverse.coff
  149. ../bin/coff2noff reverse.coff reverse
  150.  
  151. copy.o: copy.c
  152. $(CC) $(CFLAGS) -c copy.c
  153. copy: copy.o start.o
  154. $(LD) $(LDFLAGS) start.o copy.o -o copy.coff
  155. ../bin/coff2noff copy.coff copy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement