Re: gcc -MM and Makefiles

From: Vrallis (vrallis@swbell.net)
Date: 09/18/99


On Fri, 17 Sep 1999, George Greer wrote:

> On Fri, 17 Sep 1999, Zeavon wrote:
>
> >Does anyone have an easy way to add the $(CC) -c $(CFLAGS) ....  line in
> >the appropriate plraces?

Here's an abbreviated copy of my Makefile from my pretty much dead MUD
project...


--------------------------------

# C compiler to use
CC = gcc

# Any special flags you want to pass to the compiler
MYFLAGS = -O6 -Wall -ggdb3 -mamdk6

DEBUG=y

DBGFLAGS =\
        -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs \
        -Wpointer-arith -Wcast-align -Winline -Wmissing-declarations \
        -Waggregate-return -Wcast-qual

OPT=

BINDIR = ../bin

CFLAGS = $(MYFLAGS) $(PROFILE)$(OPT)

LIBS = -lcrypt

ifeq ($(DEBUG),y)
CFLAGS += $(DBGFLAGS)
endif

OBJFILES = \
        act.comm.o \
        act.informative.o \
        act.item.o \
............
        zedit.o

C_FILES = \
        act.comm.c \
        act.informative.c \
        act.item.c \
............
        zedit.c

default: all

all:    Makefile.depend
        $(MAKE) $(BINDIR)/krynn

krynn:
        $(MAKE) $(BINDIR)/krynn

$(BINDIR)/krynn : $(OBJFILES)
        $(CC) -o $(BINDIR)/krynn $(PROFILE) $(OBJFILES) $(LIBS)

clean:
        rm -f *.o

depend:
        $(CC) -MM $(C_FILES) > Makefile.depend

#for automaking it
Makefile.depend:
        $(CC) -MM $(C_FILES) > Makefile.depend

backup:
        tar czvf ~mud/backup/lok_src_`date +%m%d`_`date +%H%M`.tar.gz *.[ch] Makefile ../lib/text/news* ../lib/text/inews*

# Dependencies

%.o: %.c
        $(CC) $(CFLAGS) -c $<
include Makefile.depend

--------------------------------


Hope it helps!

Vrallis
Legends of Krynn


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST