help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: including multiple makefiles


From: Andre Merzky
Subject: Re: including multiple makefiles
Date: Wed, 14 Aug 2002 16:46:44 +0200
User-agent: Mutt/1.2.5.1i

if a file version.h and a file test exist, they won't be remade
until you mark these targets as phony:

.PHONY: test version.h

Andre.


On Wed, Aug 14, 2002 at 09:20:14AM -0500, Steve Mertz (MyLinux) wrote:
> 
> Hi.
> 
> I am trying to modularize my makefiles based on what it's doing.
> 
> Below I have pasted my various makefiles that I am trying to use.
> 
> What is happening is that the debug.mk is working, when I do a 
> make.  But "test" and "version.h" aren't being ran eventhough they
> are apart of "all:"
> 
> Why wouldn't this work?  Let me know if you need any other info.
> GNU Make version 3.79.1 
> Slackware 8.1 
> gcc version 2.95.3 20010315 (release)
> 
> Thanks for any guidance here!
> 
> So in the root directory of the source I have the main Makefile
> 
> # Makefile
> 
> include  .Makefile/.main.mk .Makefile/*
> 
> all: cc test version.h
> 
> clean:
>       @rm -f $(OBJ) $(PROGNAME) *core* version.h
> 
> cc: $(OBJ)
>       $(CC) $(INC_DIR) $(CFLAGS) -o $(PROGNAME) $(OBJ) $(LIB_DIR) $(LIBS)
> 
> test:
>       @echo Contrib: $(CONTRIB)
>       @echo Headers: $(HDR)
>       @echo Objects: $(OBJ)
>       @echo Source: $(SRC)
>       @echo Compiler: $(CC)
>       @echo Include Dir: $(INC_DIR)
>       @echo Compiler Flag: $(CFLAGS)
>       @echo Library Dir: $(LIB_DIR)
>       @echo Libraries: $(LIBS)
> 
> 
> Then, in my .Makefile I have: .main.mk debug.mk version.mk
> 
> # .main.mk
> PROGNAME= my-program
> 
> NAME= My Program
> VERSION= 0.1.0
> CC= gcc
> 
> CFLAGS= -Wall -g3
> 
> .c.o:
>       $(CC) $(INC_DIR) -c $(CFLAGS) -o $@ $<
> 
> 
> # debug.mk
> 
> CFLAGS+= -DDEBUG
> 
> DBG_DIR= ./debug/
> 
> OBJ+= $(DBG_DIR)debug.o
> SRC+= $(DBG_DIR)debug.c
> HDR+= $(DBG_DIR)debug.h
> 
> INC_DIR+= -I./debug
> 
> $(DBG_DIR)debug.o: $(DBG_DIR)debug.c $(DBG_DIR)debug.h
> 
> # version.mk
> HDR+= version.h
> 
> version.h:
>       @echo "Building version.h"
>       @echo "#define NAME \"$(NAME)\"" > version.h
>       @echo "#define VERSION \"$(VERSION)\"" >> version.h
>       @echo "#define PROGNAME \"$(PROGNAME)\"" >> version.h
>       @echo "#define BUILDDATE \"`date`\"" >> version.h
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make



-- 
+------------------------------------------------------------------+
| Andre Merzky                   | phon: ++49 - 30 - 84 1 85 - 339 |
| Zuse Institute Berlin (ZIB)    | fax : ++49 - 30 - 84 1 85 - 107 |
| - Scientific Visualization -   | mail: address@hidden             |
| Takustr. 7 - D-14195 Berlin    | www : http://www.zib.de/merzky/ |
+------------------------------------------------------------------+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]