# Makefile by Igabod with help from Tyche of www.mudbytes.net To use # this makefile, a good bit of knowledge of your code is needed. You # will need to set your mud up to startup from the area directory if # it doesn't already. You will also probably need to edit any copyover # or hotboot command to point to the exe file in the area directory. # There may be some other places you need to edit if your code has any # other parts of code that point to the .exe file. A little explanation # on how to use this makefile may be necessary, I'll do my best to be as # clear as possible. When you make a code change and type make, the code # will compile and create merc.exe (or whatever your exe file is called). # To install these changes into the live game, you will then need to type # make install and then do a copyover. Any time you do a clean compile, # you will need to manually cp your exe file to ../area and then make # install. If you don't like the color scheme of this makefile, all the # colors have been included to make color changes easier. You will need # to create a directory called "obj" within your src directory as well # as a directory called "backup". You can ignore the backup directory # if you like, but remember to remove any references to BCK_FILES and # BCK_DIRECTORY from the makefile. If you ever need to add or remove # files, you no longer need to edit the makefile due to the use of the # wildcards. If you are using Cygwin, be sure to uncomment the lines # needed and comment out the ones for Linux systems. Remember that if # you use the plaintext passwords, anybody with shell access can learn # everybody's password by looking at the pfile. If you are using a linux # shell it is highly reccommended that you use crypt(). There are no # requirements or restrictions on the use of this makefile, only a # request. I request that you release at least a small snippet of your # work. If you can't figure out how to get this makefile working for # your mud, ask for help on the forums at www.mudbytes.net. Feel free # to edit/remove any and all comments in this file. # -Igabod- # $Id $ CC = gcc RM = rm -f # Be sure to edit the below line to fit your mud's exe_file EXE = merc.exe PROF = -O -ggdb # Uncomment the line below to use Cygwin #CYGWIN = -DCYGWIN ECHOCMD = echo -e LIBS = -lcrypt # The colors Duke! The COLORS! L_NRM = \e[0;00m D_RED = \e[0;31m L_RED = \e[1;31m D_GREEN = \e[0;32m L_GREEN = \e[1;32m D_BROWN = \e[0;33m L_YELLOW = \e[1;33m D_BLUE = \e[0;34m L_BLUE = \e[1;34m D_PURPLE = \e[0;35m L_MAGENTA = \e[1;35m D_CYAN = \e[0;36m L_CYAN = \e[1;36m L_GREY = \e[0;37m L_WHITE = \e[1;37m # Use these two lines to use crypt(), ie on Linux systems. C_FLAGS = $(PROF) -Wall L_FLAGS = $(PROF) -lcrypt # Uncomment these two lines to use plaintext passwords. # This is how you fix the 'crypt' linking errors! # Use this if you are using Cygwin #L_FLAGS = $(PROF) #C_FLAGS = -Wall $(PROF) -DNOCRYPT -DQMFIXES # Source Files SRC_FILES := $(wildcard *.c) # Backup Files - Remove these lines if you don't use a backup directory BCK_DIR = backup BCK_FILES := $(BCK_DIR)/* # Object Files - Be sure to create an obj directory OBJ_DIR = obj OBJ_FILES := $(patsubst %.c,$(OBJ_DIR)/%.o,$(SRC_FILES)) # Header Files H_FILES = $(wildcard *.h) merc: $(OBJ_FILES) @$(ECHOCMD) "$(L_BLUE)[- $(L_WHITE)Rebuilding MUD executable: $(L_GREEN)merc.exe$(L_BLUE) -]$(L_NRM)" @$(ECHOCMD) "$(L_BLUE)[- $(L_YELLOW)**********$(L_CYAN)Compile Complete$(L_YELLOW)**********$(L_BLUE) -]$(L_NRM)" @$(CC) $(L_FLAGS) -o $(EXE) $(OBJ_FILES) $(LIBS) $(OBJ_DIR)/%.o: %.c $(H_FILES) @$(ECHOCMD) "$(L_BLUE)--> $(L_WHITE)Compiling file: $(L_MAGENTA)$<$(L_BLUE) <--$(L_RED)" @$(CC) $(C_FLAGS) -c -o $@ $< @$(ECHOCMD) "$(L_BLUE)[- $(L_YELLOW)$<$(L_NRM) compiled $(L_GREEN)OK$(L_BLUE) -]$(L_NRM)" # Use make clean to do a clean compile clean: @$(ECHOCMD) "$(L_BLUE)--> $(L_CYAN)Cleaning up for full make... $(L_BLUE)<-- $(L_NRM)" @$(RM) $(OBJ_FILES) $(EXE) ../area/old_$(EXE) ../area/$(EXE) *~ *.bak *.orig *.rej @$(ECHOCMD) "$(L_BLUE)[- $(L_GREEN)done$(L_NRM). $(L_BLUE)-]$(L_NRM)" # Use make install after a satisfactory compile is done then copyover. install: @$(ECHOCMD) "$(L_BLUE)**** $(L_CYAN)Updating Live Executable $(L_BLUE)****$(L_NRM)" @$(RM) $../area/old_$(EXE) @mv ../area/$(EXE) ../area/old_$(EXE) @cp $(EXE) ../area/$(EXE) @$(ECHOCMD) "$(L_GREEN)**** $(L_YELLOW)Live Executable Updated $(L_GREEN)****$(L_NRM)" # Use make cleanup to remove un-necessary files for tar-ing the source. # If you don't use a backup directory remove the reference to BCK_FILES here. cleanup: @$(ECHOCMD) "$(L_BLUE)--> $(L_CYAN)Making clean for backing up $(L_BLUE)<-- $(L_NRM)" @$(RM) $(OBJ_FILES) $(BCK_FILES) $(EXE) ../area/$(EXE) ../area/old_$(EXE) ../log/*.log *~ *.bak *.orig *.rej @$(ECHOCMD) "$(L_BLUE)[- $(L_GREEN)Ready to make a backup now$(L_NRM). $(L_BLUE)-]$(L_NRM)"