The recent discussion about makefiles and all has got me rethinking
something, and, I decided to try putting together a Makefile to compile
*.c. However, every time I've run this, I seem to enter a li'l problem.
Maybe someone can help:
A copy of the makefile (related materials anyways)

TARGET =       2k
LIBTARGET =    libmud2k.a
REALDIR  =     /muds/Dreamless/xanth/bin/
BETADIR  =     /muds/Dreamless/beta/bin/
AREADIR  =     /muds/Dreamless/beta/area/
LIBDIR =       /muds/Dreamless/xanth/src
SRCDIR =       /muds/Dreamless/beta/src/

C_FLAGS = -Wall -Wno-trigraphs $(PROF) $(NOCRYPT) -DMAIN
#C_FLAGS = -Wall -Wno-trigraphs $(PROF) $(NOCRYPT) -DMAIN -DDEBUGGING
#C_FLAGS = -Wall -Wno-trigraphs $(PROF) $(NOCRYPT) -DBETA
L_FLAGS =       $(PROF)  $(LIBS)
LIBS            = -lmysqlclient -lcrypt
LDFLAGS         = -L/usr/lib/mysql
RM      = rm -f
RM_CMD  = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~  .emacs_* 
tags TAGS *.rej *.orig  *.patch *.save *.old ${TARGET}
INCLUDE = include -I /usr/include/mysql/

# Source Files
SRC_FILES := $(wildcard *.c)

# Object Files
OBJ_DIR = obj
OBJ_FILES := $(patsubst %.c,$(OBJ_DIR)/%.o,$(SRC_FILES))

all:
        @echo               "Mud 2K files"
        @echo "-------------------------------------------------------"
        @echo "Arguments needed to compile   "
        @echo "2k        compiles game code "
        @echo "check     compiles the memory checker"
        @echo "backup    makes a backup      "
        @echo "clean     removes garbage     "
        @echo "depend    creates the files necessary for depend     "
        @echo "install   installs binary in main     "
        @echo "ginstall  installs binary for beta     "
        @echo "-------------------------------------------------------"

include .depend



rom: .depend $(OBJ_FILES)
        $(RM) -f $(TARGET)
        $(CC) -I$(INCLUDE) $(C_FLAGS) $(LDFLAGS) $(L_FLAGS) -o $(TARGET)
$(OBJ_FILES) libmud2k.a

2k: .depend $(2k_FILES)
        rm -f 2k
        $(CC)  -I$(INCLUDE) $(LDFLAGS) $(L_FLAGS)    -o 2k $(2k_FILES)
libmud2k.a
 

$(OBJ_DIR)/%.o: %.c
        $(CC) -I$(INCLUDE) $(C_FLAGS) $(LDFLAGS) $(L_FLAGS) $<
$(C_FLAGS) -c -o $@

2k is the old argument which works just as it should.. It pulls in
depend, and if I touch any .h file, the appropriate files are
recompiled.

Rom is the new argument, which works not at all like it should.
Compiling wise, it's great, BUT when any .h file is touched (in any
way), the appropriate files aren't compiled.

BTW, the spacing is right, even though it's not in the email.
Any thoughts, ideas on what I could be doing wrong with this?
-- 
TJW      :Head tech, designer, bum:P
Mud      :http://dreamless.wolfstream.net
telnet   :telnet://dreamless.wolfstream.net 9275
OLC Pages:http://olc.wolfstream.net



Reply via email to