www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/29/08:48:52

Message-Id: <199901291348.HAA17031@darwin.sfbr.org>
Date: Fri, 29 Jan 1999 07:48:11 -0600 (CST)
From: Jeff Williams <jeffw AT darwin DOT sfbr DOT org>
Subject: Re: How (not) to force make to recompile?
To: djgpp AT delorie DOT com
MIME-Version: 1.0
X-Mailer: dtmail 1.2.0 CDE Version 1.2 SunOS 5.6 sun4m sparc
Reply-To: djgpp AT delorie DOT com

-: 
-: On Wed, 27 Jan 1999, Ya'qub wrote:
-: 
-: >     Compilation in my makefile depends on several switches that I define in
-: > the makefile. However, if I decde to edit the makefile and add a new 
switch,
-: > when I run make it says that the executable is up to date. How can I force
-: > make to rebuild everything since now there is a new set of compilation
-: > switches that I want?
-: 
-: On Wed, 27 Jan 1999, Eli Zaretskii wrote:
-:
-: The simplest (and the most correct) way is to make all important targets 
-: of the Makefile be dependent on the Makefile itself.
-: 
-: Another possibility is to invoke Make with the `-W' switch, so it 
-: ``thinks'' that some file has changed.  For example, if all of your files 
-: include a header called `foo.h', "make -W foo.h" will recompile and 
-: relink everything.

Ok, this is interesting, because not once in a year of using Make, with
DJGPP and bash, have I ever gotten the message that an executable is
up-to-date (even if nothing has been changed).  If, for example, I
issue a second `make' following the first `make', the executable is
always relinked using the existing object files.  Why? (portion of a
typical makefile follows).

jeff

#
# Makefile
#

ifneq ($(COMSPEC),)
arc = -m386
exe = .exe
sep = ;
else
arc =
exe =
sep = :
endif

SHELL = /bin/sh
MAKESHELL = /bin/sh
vpath %.c $(HOME)/c/nifl/src$(sep)$(HOME)/c/nr/src
INCLUDE = -I$(HOME)/c/nifl/include -I$(HOME)/c/nr/include

# Where the programs should be installed
BIN = .

# Libraries to link against
LIBS = -lm

# How the C compiler should be invoked
CC = gcc

# Compiler flags
CFLAGS = -O2 -g -Wall -ansi $(arc) $(INCLUDE)
LDFLAGS = -s

# Executable extension
EXT = $(exe)

DATA =
DRIVERS =
OTHERS =
ROUTINES =

all:		$(DRIVERS) $(OTHERS)

xibs:		xibs.o kin.o covcor.o pearsn.o erfcc.o betai.o betacf.o \
		gammln.o nrutil.o
		$(CC) $(LDFLAGS) -o $@$(EXT) $^ $(LIBS)

install:
		-cp -p $(DRIVERS) $(DRIVERS:=.exe) $(DATA) $(BIN)
		-cp -p $(OTHERS) $(OTHERS:=.exe) $(BIN)
clean:
		rm -f *.o
		rm -f $(DRIVERS) $(DRIVERS:=.exe)
		rm -f $(OTHERS) $(OTHERS:=.exe)
		

- Raw text -


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