| [9] | 1 | # | 
|---|
|  | 2 | # Makefile for mdb | 
|---|
|  | 3 | # | 
|---|
|  | 4 | # | 
|---|
|  | 5 | # Edit as indicated below. | 
|---|
|  | 6 | # | 
|---|
|  | 7 | USR             =/usr | 
|---|
|  | 8 | # | 
|---|
|  | 9 | # (1) For Compiler and target system: | 
|---|
|  | 10 | # | 
|---|
|  | 11 | # | 
|---|
|  | 12 | # For ANSI C and Minix 1.7.x 32-bit | 
|---|
|  | 13 | # | 
|---|
|  | 14 | CC              =exec cc | 
|---|
|  | 15 | LD              =exec cc | 
|---|
|  | 16 | LDFLAGS         =-i | 
|---|
|  | 17 | TARGET          =mdb | 
|---|
|  | 18 | STACK           =200000 | 
|---|
|  | 19 | # | 
|---|
|  | 20 | # (2) If kernel and mm are not in "/usr/src" change this | 
|---|
|  | 21 | # | 
|---|
|  | 22 | SYSTEM  =$(USR)/src | 
|---|
|  | 23 | # | 
|---|
|  | 24 | # (3) Select Options | 
|---|
|  | 25 | # | 
|---|
|  | 26 | # i)   For GNU_EXEC Support, uncomment: | 
|---|
|  | 27 | # | 
|---|
|  | 28 | #FOR_GNU                =gnu_sym.o gnu_load.o | 
|---|
|  | 29 | #DEF_GNU                =-DGNU_SUPPORT | 
|---|
|  | 30 | # | 
|---|
|  | 31 | # ii)  For tracing of syscalls, uncomment: | 
|---|
|  | 32 | # | 
|---|
|  | 33 | #FOR_SYSCALLS   =syscalls.o decode.o ioctl.o | 
|---|
|  | 34 | #DEF_SYSCALLS   =-DSYSCALLS_SUPPORT | 
|---|
|  | 35 | # | 
|---|
|  | 36 | # iii) For no debugging of mdb, uncomment: | 
|---|
|  | 37 | # | 
|---|
|  | 38 | #DEF_DEBUG      =-DNDEBUG | 
|---|
|  | 39 |  | 
|---|
|  | 40 | EXTRA_OBJS      =$(FOR_GNU) $(FOR_SYSCALLS) | 
|---|
|  | 41 | EXTRA_DEFS      =$(DEF_GNU) $(DEF_SYSCALLS) $(DEF_DEBUG) | 
|---|
|  | 42 |  | 
|---|
|  | 43 | all:    $(TARGET) | 
|---|
|  | 44 |  | 
|---|
|  | 45 | CFLAGS  =-I$(SYSTEM) -I$(SYSTEM)/servers -I$(INCLUDE) -D_MINIX -D_POSIX_SOURCE $(EXTRA_DEFS) | 
|---|
|  | 46 |  | 
|---|
|  | 47 | # For various included files or system files | 
|---|
|  | 48 | # | 
|---|
|  | 49 | INCLUDE         =$(USR)/include | 
|---|
|  | 50 | KERNEL          =$(SYSTEM)/kernel | 
|---|
|  | 51 | PTRACE          =$(INCLUDE)/sys/ptrace.h | 
|---|
|  | 52 |  | 
|---|
|  | 53 |  | 
|---|
|  | 54 | # Header files from pm (used by core.c) | 
|---|
|  | 55 | # | 
|---|
|  | 56 | MMFILES=        $(SYSTEM)/servers/pm/const.h \ | 
|---|
|  | 57 | $(SYSTEM)/servers/pm/type.h \ | 
|---|
|  | 58 | $(SYSTEM)/servers/pm/mproc.h | 
|---|
|  | 59 |  | 
|---|
|  | 60 | # Header files from system and kernel in "mdb.h" | 
|---|
|  | 61 | # | 
|---|
|  | 62 | SYSFILES=       $(INCLUDE)/minix/config.h \ | 
|---|
|  | 63 | $(INCLUDE)/minix/const.h \ | 
|---|
|  | 64 | $(INCLUDE)/ansi.h \ | 
|---|
|  | 65 | $(INCLUDE)/minix/type.h \ | 
|---|
|  | 66 | $(INCLUDE)/limits.h \ | 
|---|
|  | 67 | $(INCLUDE)/errno.h \ | 
|---|
|  | 68 | $(INCLUDE)/sys/types.h \ | 
|---|
|  | 69 | $(KERNEL)/const.h \ | 
|---|
|  | 70 | $(KERNEL)/type.h \ | 
|---|
|  | 71 | $(KERNEL)/proc.h | 
|---|
|  | 72 |  | 
|---|
|  | 73 | # Common objects | 
|---|
|  | 74 | # | 
|---|
|  | 75 | OBJCOMMON       =mdb.o mdbexp.o kernel.o sym.o trace.o core.o misc.o io.o | 
|---|
|  | 76 |  | 
|---|
|  | 77 | # Common source | 
|---|
|  | 78 | # | 
|---|
|  | 79 | SRCCOMMON       =mdb.c mdbexp.c kernel.o sym.c trace.c core.c misc.c io.c | 
|---|
|  | 80 |  | 
|---|
|  | 81 | # Object files for PC | 
|---|
|  | 82 | # | 
|---|
|  | 83 | OBJPC           =$(OBJCOMMON) mdbdis86.o | 
|---|
|  | 84 |  | 
|---|
|  | 85 | # Source file | 
|---|
|  | 86 | # | 
|---|
|  | 87 | SRCPC           =$(SRCCOMMON) mdbdis86.c | 
|---|
|  | 88 |  | 
|---|
|  | 89 |  | 
|---|
|  | 90 | mdb:    $(OBJPC) $(EXTRA_OBJS) | 
|---|
|  | 91 | $(LD) $(LDFLAGS) -o mdb $(OBJPC) $(EXTRA_OBJS) | 
|---|
|  | 92 | install -S $(STACK) mdb | 
|---|
|  | 93 |  | 
|---|
|  | 94 | # | 
|---|
|  | 95 | # Dependencies for objects | 
|---|
|  | 96 | # | 
|---|
|  | 97 | mdb.o:          mdb.c mdb.h $(SYSFILES) proto.h | 
|---|
|  | 98 | mdbdis86.o:     mdbdis86.c mdb.h $(SYSFILES) proto.h | 
|---|
|  | 99 | mdbexp.o:       mdbexp.c mdb.h $(SYSFILES) proto.h | 
|---|
|  | 100 | sym.o:          sym.c mdb.h $(SYSFILES) proto.h | 
|---|
|  | 101 | trace.o:        trace.c mdb.h $(PTRACE) $(SYSFILES) proto.h | 
|---|
|  | 102 | core.o:         core.c mdb.h $(MMFILES) $(SYSFILES) proto.h | 
|---|
|  | 103 | misc.o:         misc.c mdb.h  $(SYSFILES) proto.h | 
|---|
|  | 104 | io.o:           io.c mdb.h $(SYSFILES) proto.h | 
|---|
|  | 105 |  | 
|---|
|  | 106 | syscalls.o:     syscalls.c mdb.h $(SYSFILES) proto.h | 
|---|
|  | 107 | decode.o:       decode.c mdb.h $(INCLUDE)/minix/callnr.h $(SYSFILES) proto.h | 
|---|
|  | 108 | ioctl.o:        ioctl.c mdb.h  $(SYSFILES) proto.h | 
|---|
|  | 109 |  | 
|---|
|  | 110 | gnu_sym.o:      gnu_sym.c mdb.h $(INCLUDE)/gnu/a.out.h $(SYSFILES) proto.h | 
|---|
|  | 111 | gnu_load.o:     gnu_load.c $(INCLUDE)/gnu/a.out.h $(SYSFILES) proto.h | 
|---|
|  | 112 |  | 
|---|
|  | 113 | $(INCLUDE)/gnu/a.out.h: a.out.h | 
|---|
|  | 114 | install -c -o bin a.out.h $(INCLUDE)/gnu | 
|---|
|  | 115 |  | 
|---|
|  | 116 |  | 
|---|
|  | 117 | # | 
|---|
|  | 118 | # install | 
|---|
|  | 119 | # | 
|---|
|  | 120 |  | 
|---|
|  | 121 | install:        mdb | 
|---|
|  | 122 | install -cs -o bin mdb /usr/bin | 
|---|
|  | 123 |  | 
|---|
|  | 124 | install_man:    mdb.1 ptrace.2 | 
|---|
|  | 125 | install -c -o bin mdb.1 /usr/man/man1 | 
|---|
|  | 126 | install -c -o bin ptrace.2 /usr/man/man2 | 
|---|
|  | 127 | clean: | 
|---|
|  | 128 | rm -f *.o mdb | 
|---|
|  | 129 |  | 
|---|