1 2 CC = g++ 3 LD = g++ 4 5 OPATH = .generated 6 BINDIR = bin 7 8 ## 9 # Set these parameters to match your own setup 10 ## 11 REMOTE_MACHINE = chianti 12 REMOTE_PATH = afs_sync/mapreduce_trivial 13 REMOTE_RSYNC_TARGET = gibson@chianti:$(REMOTE_PATH) 14 15 # list your binaries here 16 BINARIES = $(BINDIR)/sumArray 17 18 # don't modify this line 19 CCFLAGS = -c 20 LDFLAGS = -lm -lpthread -lrt -lcpc 21 22 # add other CFLAGS here 23 CCFLAGS += -O3 24 25 LINK_MESSAGE = "\033[32;1m\n***Making binary \033[33m%s\033[32m...\n\033[m" 26 COMPILE_MESSAGE = "\033[32;1m\n*Compiling \033[33m%s\033[32m...\n\033[m" 27 28 # list OBJFILES here for each binary 29 # for files with header dependencies, include build rule below, 30 # otherwise default build rule is sufficient 31 OBJFILES_COMMON = $(OPATH)/fatals.o \ 32 $(OPATH)/MapReduceScheduler.o 33 OBJFILES_SUMARRAY = $(OBJFILES_COMMON) \ 34 $(OPATH)/main.o 35 36 remote: 37 @printf "\033[34;1m\nSyncing Remote Directory...\n\033[m" 38 rsync -av . $(REMOTE_RSYNC_TARGET) 39 @printf "\033[34;1m\nInitiating Remote Build...\n\033[m" 40 ssh $(REMOTE_MACHINE) ./remoteMake.tcsh $(REMOTE_PATH) $* 41 42 all: $(OPATH) $(BINDIR) $(BINARIES) 43 @printf "\033[34;1m\nMy work here is done.\n\033[m" 44 45 $(OPATH): 46 @printf "\033[32;1m\nMaking \033[33m$(OPATH)/ \033[32mpath for object files...\n\033[m" 47 mkdir $(OPATH) 48 49 $(BINDIR): 50 @printf "\033[32;1m\nMaking \033[33m$(BINDIR)/ \033[32mpath for binaries...\n\033[m" 51 mkdir $(BINDIR) 52 53 # binary targets are like this 54 $(BINDIR)/sumArray: $(OBJFILES_SUMARRAY) 55 @printf $(LINK_MESSAGE) "sumArray" 56 $(LD) $(LDFLAGS) $(OBJFILES_SUMARRAY) -o $@ 57 58 $(OPATH)/fatals.o: fatals.cpp fatals.h 59 @printf $(COMPILE_MESSAGE) "$<" 60 $(CC) $(CCFLAGS) $< -o $@ 61 62 $(OPATH)/main.o: main.C fatals.h MapReduceScheduler.h 63 @printf $(COMPILE_MESSAGE) "$<" 64 $(CC) $(CCFLAGS) $< -o $@ 65 66 $(OPATH)/MapReduceScheduler.o: MapReduceScheduler.c MapReduceScheduler.h 67 @printf $(COMPILE_MESSAGE) "$<" 68 $(CC) $(CCFLAGS) -D_SOLARIS_ $< -o $@ 69 70 # default build rule 71 $(OPATH)/%.o: %.c $(OPATH) 72 @printf $(COMPILE_MESSAGE) "$<" 73 $(CC) $(CCFLAGS) $< -o $@ 74 75 almost_clean: 76 @printf "\033[34;1m\nMaking \033[31;1malmost\033[34;1m clean ... (saving binaries)\n\033[m" 77 -rm -rf core* *.o 78 -rm -rf $(OPATH) 79 80 clean: 81 @printf "\033[34;1m\nCleaning up...\n\033[m" 82 -rm -rf core* $(BINARIES) *.o 83 -rm -rf $(BINDIR) 84 -rm -rf $(OPATH) 85 @printf "\033[34;1m\nSyncing Remote Directory...\n\033[m" 86 rsync -av --delete . $(REMOTE_RSYNC_TARGET) 87