1 # 2 # Created by gmakemake (Sparc Jul 27 2005) on Fri Jul 1 22:59:56 2011 3 # 4 5 # 6 # Definitions 7 # 8 9 .SUFFIXES: 10 .SUFFIXES: .a .o .c .C .cpp 11 .c.o: 12 $(COMPILE.c) $< 13 .C.o: 14 $(COMPILE.cc) $< 15 .cpp.o: 16 $(COMPILE.cc) $< 17 .c.a: 18 $(COMPILE.c) -o $% $< 19 $(AR) $(ARFLAGS) $@ $% 20 $(RM) $% 21 .C.a: 22 $(COMPILE.cc) -o $% $< 23 $(AR) $(ARFLAGS) $@ $% 24 $(RM) $% 25 .cpp.a: 26 $(COMPILE.cc) -o $% $< 27 $(AR) $(ARFLAGS) $@ $% 28 $(RM) $% 29 30 CC = gcc 31 CXX = g++ 32 33 RM = rm -f 34 AR = ar 35 LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) 36 LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) 37 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c 38 COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c 39 40 ########## Default flags (redefine these with a header.mak file if desired) 41 CXXFLAGS = -ggdb 42 CFLAGS = -ggdb 43 CLIBFLAGS = -lm 44 CCLIBFLAGS = 45 ########## End of default flags 46 47 48 CPP_FILES = FileSys.cpp Shell.cpp main.cpp 49 C_FILES = 50 H_FILES = FileSys.h Shell.h 51 SOURCEFILES = $(H_FILES) $(CPP_FILES) $(C_FILES) 52 .PRECIOUS: $(SOURCEFILES) 53 OBJFILES = FileSys.o Shell.o 54 55 # 56 # Main targets 57 # 58 59 all: main 60 61 main: main.o $(OBJFILES) 62 $(CXX) $(CXXFLAGS) -o os1shell main.o $(OBJFILES) $(CCLIBFLAGS) 63 64 # 65 # Dependencies 66 # 67 68 FileSys.o: FileSys.h 69 Shell.o: FileSys.h Shell.h 70 main.o: FileSys.h Shell.h 71 72 # 73 # Housekeeping 74 # 75 76 Archive: archive.tgz 77 78 archive.tgz: $(SOURCEFILES) Makefile 79 tar cf - $(SOURCEFILES) Makefile | gzip > archive.tgz 80 81 clean: 82 -/bin/rm -r $(OBJFILES) main.o core 2> /dev/null 83 84 realclean: clean 85 /bin/rm -rf os1shell
一个参考的makefile文件,可以在此基础上改。
参考:
https://raw.github.com/emr4378/FAT-File-System/master/makefile