|
From: | Andrea Riciputi |
Subject: | How to compile with different CFLAGS. |
Date: | Tue, 18 Feb 2003 09:55:14 +0100 |
Hi,I hope you can help me to improve my understanding of make, that it's very poor indeed. Here is my make file, mostly stolen from the one on the Paul's site.
CCompiler = gcc CFLAGS = -O2 -Wno-long-double -I/sw/include DEBUGCFLAGS = -g -Wno-long-double -I/sw/include LDFLAGS = -L/sw/lib -lgsl -lgslcblas -lmSourceFiles = CArrays.c Grid1d.c my_func.c my_base.c my_type.c my_analitic.cObjectFiles = $(patsubst %.c,%.o,$(SourceFiles)) ifeq (,$(filter zzz%,$(notdir $(CURDIR)))) include target.mk else #----- End Boilerplate VPATH = $(SRCDIR) .PHONY: C C: NewGal.exe NewGal.exe: $(ObjectFiles) $(CCompiler) $(CFLAGS) $(LDFLAGS) $^ -o $@ %.o: %.c $(CCompiler) $(CFLAGS) -c $^ -o $@ .PHONY: debug debug: NewGal_gdb.exe NewGal_gdb.exe: $(ObjectFiles) $(CCompiler) $(DEBUGCFLAGS) $(LDFLAGS) $^ -o $@ %.o: %.c $(CCompiler) $(DEBUGCFLAGS) -c $^ -o $@
My intention is to compile my source files with different flags depending on which PHONY target I give as make's argument. But, obviously, it doesn't work. Any suggestion?
More generally, how can I get done different actions associeted with the same rule (I mean same prerequisites and same target)?
Thanks in advance, Andrea. --- Andrea Riciputi "Science is like sex: sometimes something useful comes out, but that is not the reason we are doing it" -- (Richard Feynman)
[Prev in Thread] | Current Thread | [Next in Thread] |