CC = g++
#PROF = -p
#Uncomment to compile in Cygwin
CYGWIN = -DCYGWIN
#Uncomment the line below if you are getting undefined references to dlsym, dlopen, and dlclose.
#Comment it out if you get errors about ldl not being found.
NEED_DL = -ldl
#Some systems need this for dynamic linking to work.
EXPORT_SYMBOLS = -export-dynamic
# Uncomment the two lines below if compiling on a Solaris box
#SOLARIS_FLAG = -Dsun -DSYSV
#SOLARIS_LINK = -lnsl -lsocket
W_FLAGS = -Wall -Werror -Wshadow -Wformat-security -Wpointer-arith -Wcast-align -Wredundant-decls -Wconversion
C_FLAGS = -g2 $(W_FLAGS) $(SOLARIS_FLAG) $(PROF) $(EXPORT_SYMBOLS)
L_FLAGS = $(PROF) $(SOLARIS_LINK) -lz $(NEED_DL)
#D_FLAGS : For the DNS Slave process. No need in linking all the extra libs for this.
D_FLAGS = -g2 -O $(PROF) $(SOLARIS_LINK)
C_FILES = act_move.c build.c db.c handler.c hashstr.c interp.c \
magic.c misc.c mud_comm.c reset.c savearea.c tables.c
O_FILES := $(patsubst %.c,o/%.o,$(C_FILES))
H_FILES = $(wildcard *.h)
all:
$(MAKE) -s converter
# pull in dependency info for *existing* .o files
-include dependencies.d
ifdef CYGWIN
converter: $(O_FILES)
rm -f converter.exe
dlltool --export-all --output-def converter.def $(O_FILES)
dlltool --dllname converter.exe --output-exp converter.exp --def converter.def
$(CC) -o converter.exe $(O_FILES) converter.exp $(L_FLAGS)
@echo "Generating dependency file ...";
@$(CC) -MM $(C_FLAGS) $(C_FILES) > dependencies.d
@perl -pi -e 's.^([a-z]).o/$$1.g' dependencies.d
@echo "Done compiling mud.";
chmod g+w converter.exe
chmod a+x converter.exe
chmod g+w $(O_FILES)
clean:
@rm -f o/*.o converter.exe dependencies.d *~
else
converter: $(O_FILES)
rm -f converter
$(CC) -export-dynamic -o converter $(O_FILES) $(L_FLAGS)
@echo "Generating dependency file ...";
@$(CC) -MM $(C_FLAGS) $(C_FILES) > dependencies.d
@perl -pi -e 's.^([a-z]).o/$$1.g' dependencies.d
@echo "Done compiling mud.";
chmod g+w converter
chmod a+x converter
chmod g+w $(O_FILES)
clean:
@rm -f o/*.o converter dependencies.d *~
endif
indent:
indent -ts3 -nut -nsaf -nsai -nsaw -npcs -npsl -ncs -nbc -bls -prs -bap -cbi0 -cli3 -bli0 -l125 -lp -i3 -cdb -c1 -cd1 -sc -pmt $(C_FILES)
indent -ts3 -nut -nsaf -nsai -nsaw -npcs -npsl -ncs -nbc -bls -prs -bap -cbi0 -cli3 -bli0 -l125 -lp -i3 -cdb -c1 -cd1 -sc -pmt $(H_FILES)
indentclean:
rm *.c~ *.h~
o/%.o: %.c
echo " Compiling $@....";
$(CC) -c $(C_FLAGS) $< -o $@
.c.o: mud.h
$(CC) -c $(C_FLAGS) $<