www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/07/11:50:32

Xref: news2.mv.net comp.os.msdos.djgpp:6835
From: Ian Miller <itmiller AT dra DOT hmg DOT gb>
Newsgroups: comp.os.msdos.djgpp
Subject: make automatic dependency generation
Date: Mon, 05 Aug 1996 12:13:17 +0100
Organization: DRA HASN
Lines: 31
Message-ID: <3205D74D.2781E494@dra.hmg.gb>
NNTP-Posting-Host: 146.80.115.106
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

If you ever read the make info about automatic dependency
generation but couldn't get it working for djgpp follow the
example I give below. The important (and difficult) part is
the sed expression. The rest I include for completishness.

--- Start of Makefile extract ---
OBJ = foo.o

VPATH=../include
vpath %.cc ../src

COMPILE.cc = gcc
LINK.cc    = gcc
CPPFLAGS   = $(patsubst %,-I%,$(subst :, ,$(VPATH))) -I-
CXXFLAGS   = -Wall -O3 -m486
LDLIBS     = -liostream -lgrx20

ifdef DEBUG
CXXFLAGS += -g
endif

# DEPENDENCIES

%.d: %.cc
	command /c $(COMPILE.cc) -M $(CPPFLAGS) $< | sed
'sx^[[:alnum:]./]*$*.ox$*.o $@xg' > $@

include $(OBJ:.o=.d)
--- End of Makefile extract ---
-- 
Ian Miller, DORSET, UK

- Raw text -


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