help-make
[Top][All Lists]
Advanced

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

Disabling a makefile template quickly


From: Alexander Farber
Subject: Disabling a makefile template quickly
Date: Sat, 16 Oct 2004 08:46:29 +0000
User-agent: Mutt/1.4.1i

Hi,

I have about 300 makefiles in subdirectories, which 
just set some variables and then include a template 
file from the top directory:

    TOPDIR = /mnt/sw
    TARGET = prog.exe
    SOURCE = one.c two.c 
    LIBRARY = three.lib four.lib 

    include $(TOPDIR)/MakeTemplate.exe

And the actuall building rules are defined in around 
8-10 MakeTemplate.* makefiles in the top directory:

    SRCS = $(filter %.c, $(SOURCE))
    OBJS = $(addprefix $(OBJDIR)/, $(notdir $(SRCS:.c=.o)))
    .....

    all: $(OBJS) $(CXXOBJS)

    $(OBJS): $(OBJDIR)/%.o: %.c
            $(CXX) $(CXXFLAGS) -c $< -o $@

    $(CXXOBJS): $(OBJDIR)/%.o: %.cpp
            $(CXX) $(CXXFLAGS) -c $< -o $@
    .....

    .PHONY: all clean

Sometimes I have to disable some of the MakeTemplates,
for example don't build the .exe type above. I wonder, 
if there is a nice way to do that?

I could for example delete the prerequisites from

    all: $(OBJS) $(CXXOBJS)

but it is uncomfortable and it would be difficult to explain 
to users: "to reenable .exe, please find the all-rule and ..."

And if I set CXX = touch $@, that will probably also work,
but the build process will waste time touching unneeded files.

So I wonder if there is some nice trick, some variable or
special rule, which I could set or uncomment in the MakeTemplate?

Regards
Alex





reply via email to

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