Message-Id: <199901291348.HAA17031@darwin.sfbr.org> Date: Fri, 29 Jan 1999 07:48:11 -0600 (CST) From: Jeff Williams Subject: Re: How (not) to force make to recompile? To: djgpp AT delorie DOT com MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Content-MD5: 6S5z1HZmfVth4N5tusgH0Q== 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)