# This is a makefile for the DLX OS projects. # # IMPORTANT: You MUST use GNU make (gmake) with this GNUmakefile. Regular # make will not work. Many Linux systems use GNU make by default, but # Solaris usually doesn't. On Solaris, use gmake to get GNU make. # # Author : Ethan L. Miller # # Version: $Id: GNUmakefile,v 1.1.1.1 2003/11/12 18:06:35 elm Exp $ ####################################################################### # # STUDENTS: list files you want included in the tar file in the following # line (separate file names by spaces). Then, using # make tarball # will generate a compressed tar file of all the files you should # hand in, and none of the ones you shouldn't. # # NOTE: You may want to REMOVE shell.exe and userprog.c if # you're not turning them in.... # # For example, if you wanted to turn in shell.c, myprogram1.c, # and myprogram2.c in addition to the "usual" DLXOS files, # the line would look like: # STUDENTFILES = shell.c myprogram1.c myprogram2.c # ####################################################################### STUDENTFILES = shell.exe userprog.c ####################################################################### # # This line reflects any files that you've added to the operating system. # User programs should be listed above in STUDENTFILES; this line is only # for files that must be compiled into the OS that you may have added. # ####################################################################### STUDENTOSSRCS = ####################################################################### # # Set PROJ2SOLUTIONS to yes if you want to use the supplied Project #2 # solutions for testing or otherwise. Set it to no if you want to use # your own solutions. # ####################################################################### PROJ2SOLUTIONS = yes ####################################################################### # # If necessary, fix this line to point to the directory in which the # DLX compiler and assembler are found. If you're working on CATS, # uncomment the line that contains /afs and comment out the other # DLXTOOLS line. # ####################################################################### #DLXTOOLS = /afs/cats/courses/cmps111-elm/dlx/bin DLXTOOLS = /Users/elm/bin ####################################################################### # # You might need to adjust these lines to reflect the location of the # (regular) executables on your system. # ####################################################################### CP = /bin/cp RM = /bin/rm TAR = tar CC = $(DLXTOOLS)/gcc-dlx AS = $(DLXTOOLS)/dlxasm TARFILE = dlxos.tar.gz INCS = dlxos.h traps.h filesys.h memory.h misc.h process.h queue.h \ synch.h syscall.h dlx.h SRCS = filesys.c memory.c misc.c process.c queue.c traps.c sysproc.c \ synch.c $(STUDENTOSSRCS) trap_random.s dlxos.s OBJS = $(addsuffix .o, $(basename $(SRCS))) OTHERS = osend.s usertraps.s GNUmakefile DIR = $(notdir $(PWD)) TARGET = os.exe ####################################################################### # # If doing Poject #2 solutions, add proj2.s as a source file and # define the appropriate C flags. # ####################################################################### ifeq ($(PROJ2SOLUTIONS),yes) CFLAGS = -mtraps -O3 -finline-functions -DPROJ2_SOLUTIONS SRCS += proj2.s else CFLAGS = -mtraps -O3 -finline-functions endif # These rules automagically build .o files from either C (.c) or assembly (.s) # files. Note that the DLX C compiler correctly handles assembly language # files, and that the assembler doesn't produce .o files.... .s.o: $(CC) $(CFLAGS) -c $< .c.o: $(CC) $(CFLAGS) -c $< # This line makes the actual DLX executable from the DLX assembly file (os.dlx) $(TARGET): os.dlx $(AS) -i _osinit -l os.lst os.dlx ####################################################################### # # IMPORTANT: osend.o must be the LAST object linked into os.dlx. It's used # to find the end of the operating system and the start of free memory. # This is why osend.o is mentioned separately, and why it must appear after # $(OBJS) in the compile command. # ####################################################################### os.dlx: $(OBJS) osend.o $(CC) -mtraps -O3 $(OBJS) osend.o -o os.dlx # userprog is a sample user program. Compile it by doing: # make userprog userprog : userprog.o misc.o usertraps.o $(CC) -mtraps -O3 userprog.o misc.o usertraps.o -o userprog.dlx $(AS) -l userprog.lst userprog.dlx ####################################################################### # # Build the shell automagically from shell.c if it's present. # ####################################################################### ifeq ($(wildcard shell.c), shell.c) shell: shell.o misc.o usertraps.o $(CC) -mtraps -O3 shell.o misc.o usertraps.o -o shell.dlx $(AS) -l shell.lst shell.dlx shell.exe: shell endif ####################################################################### # # Compile proj2.s from proj2.c if proj2.c is there. It won't be there in # student-delivered tarballs. # ####################################################################### ifeq ($(wildcard proj2.c), proj2.c) proj2.s: proj2.c $(CC) $(CFLAGS) -c $< mv $*.o $*.s endif ####################################################################### # # This target generates a tar file with all of the useful files in it. # ####################################################################### tarball: $(SRCS) $(INCS) $(OTHERS) $(STUDENTFILES) os.dlx cd .. ; $(TAR) cvf - $(addprefix $(DIR)/, $(SRCS) $(INCS) $(OTHERS) $(STUDENTFILES)) | gzip - > $(TARFILE) Makefile.depend: depend depend: $(SRCS) $(INCS) $(CC) -MM $(SRCS) > Makefile.depend clean: $(RM) -f *.o *.dlx *~ spotless: clean $(RM) -f *.obj *.exe *.lst Makefile.depend vm include Makefile.depend