www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/04/19:15:41

From: "Jeremiah Zanin" <jzanin AT cs DOT unm DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Automatic dependancies and header files, help!
Date: Sat, 4 Jul 1998 16:57:55 -0600
Organization: University of New Mexico, Albuquerque
Lines: 77
Message-ID: <6nmcd3$11ai$1@lynx.unm.edu>
NNTP-Posting-Host: ppp-019.unm.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ok, I looked at the old mail archives and found messages on 'makedepend' and
the solution:

DEPS := $(wildcard *.d)
ifneq ($(DEPS),)
include $(DEPS)
endif

The only problem is that when I change a header file, the C files that
depend on it don't get recompiled.  What's going on?

Here's the makefile:

CC   = gcc
CFLAGS   = -MMD -O2
LFLAGS  = -s -lgpp
EXE  = Upheaval.exe
COMPRESS = djp -q
OBJDIR  = ../objs
OBJDIR2         = ..\objs
EXEDIR  = ..

OBJECTS  = $(OBJDIR)/Dma.o \
    $(OBJDIR)/Graphics.o \
    $(OBJDIR)/Keyboard.o \
    $(OBJDIR)/main.o \
     $(OBJDIR)/Mouse.o \
    $(OBJDIR)/Pcx.o \
    $(OBJDIR)/PhysicalObject.o \
    $(OBJDIR)/SoundBlaster.o \
     $(OBJDIR)/Vector.o \
    $(OBJDIR)/Vga.o \
    $(OBJDIR)/Wav.o

$(EXEDIR)/$(EXE) : $(OBJECTS)
$(CC) $(OBJECTS) -o $(EXEDIR)/$(EXE) $(CFLAGS) $(LFLAGS)
$(COMPRESS) $(EXEDIR)/$(EXE)

$(OBJDIR)/%.o : %.C
$(CC) -c $< -o $(OBJDIR)/$(<:.C=.o) $(CFLAGS)

clean :
del $(EXEDIR)\$(EXE)
del $(OBJDIR2)\*.o
del *.d

DEPS := $(wildcard *.d)
ifneq ($(DEPS),)
include $(DEPS)
endif

Thanks.

Jeremiah Zanin
Email: jzanin AT cs DOT unm DOT edu
Webpage: http://www.unm.edu/~strider7

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

Problem-Solving Algorithm I:
        1) Write down the problem
        2) Think real hard
        3) Write down the answer.
-- Richard Feynman, Nobel Prize Winner in Physics

Problem-Solving Algorithm II:
        1) Write down the problem
        2) Start Hacking
        3) Debug
        4) Goto 2
-- Matthew Bauer, aka CodeZilla

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




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019