help-make
[Top][All Lists]
Advanced

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

including multiple makefiles


From: Steve Mertz (MyLinux)
Subject: including multiple makefiles
Date: 14 Aug 2002 09:20:14 -0500

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








reply via email to

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