CC      = gcc
PROF    =
NOCRYPT =
#Uncomment the next line if you want request support
#DBUGFLG = -DREQUESTS
C_FLAGS = -g3 -Wall -export-dynamic $(PROF) $(NOCRYPT) $(DBUGFLG)
L_FLAGS = -ldl $(PROF)

C_FILES =  11.c      act_comm.c     act_info.c    act_move.c    act_obj.c    act_wiz.c      boards.c \
       bounty.c         build.c      changes.c       clans.c       comm.c   comments.c       const.c \
           db.c        editor.c        fight.c       finfo.c      force.c    fskills.c   functions.c \
      handler.c       hashstr.c       hunter.c          id.c     interp.c      magic.c    makeobjs.c \
     marriage.c           md5.c         misc.c    mud_comm.c   mud_prog.c   newarena.c      pfiles.c \
      planets.c        player.c     requests.c       reset.c       save.c      ships.c       shops.c \
       skills.c       slicers.c        space.c     special.c   swskills.c     tables.c        tech.c \
        track.c        update.c 


O_FILES := $(patsubst %.c,o/%.o,$(C_FILES))

H_FILES = $(wildcard *.h) 


   SWR = swr

all:
	$(MAKE) -s swr

swr  : $(O_FILES)
	rm -f $(SWR)
	$(CC) -export-dynamic -o $(SWR) $(O_FILES) $(L_FLAGS) -lm -lcrypt
	echo "                   ";
	echo "Done compiling mud.";
	chmod g+w $(SWR)
	chmod a+x $(SWR)
	chmod g+w $(O_FILES)


clean:  
	rm -f o/*.o $(SWR) core  
#	$(MAKE) all
        
purge:  
	rm -f o/*.o $(SWR) core 

o/%.o: %.c
#	echo "  Compiling $@....";
	echo " $@";
	$(CC) -c $(C_FLAGS) $< -o $@

.c.o: mud.h
	$(CC) -c $(C_FLAGS) $<

