Reputation: 15099
I have this Makefile:
CC = @gcc
RM = @rm
TARGET = test
PLUGINS_DIR = plugins
PLUGINS_C = $(wildcard $(PLUGINS_DIR)/*.c)
PLUGINS_O = $(patsubst %.c,%.o, $(PLUGINS_C))
PLUGINS_SO = $(patsubst %.c,%.so, $(PLUGINS_C))
.PHONY: plugins
new: clean all
all: $(TARGET) $(PLUGINS_SO)
$(TARGET): $(TARGET).o
$(CC) -o $@ $^ -g -Wall -std=gnu99 -ldl -Wl,--export-dynamic
$(PLUGINS_DIR)/%.so: $(PLUGINS_DIR)/%.o
$(CC) $^ -o $@ -shared
$(PLUGINS_DIR)/%.o: $(PLUGINS_DIR)/%.c
$(CC) -c $< -o $@ -pedantic -g -Wall -std=c99 -fpic -I.
clean:
$(RM) -rf $(TARGET) *.o *.a $(PLUGINS_O) $(PLUGINS_SO)
but the clean
is still outputing a message! (rm plugins/tt.o plugins/kk.o
)
If I remove the @
in front of the rm
then I get yet another message, besides the first one: rm -rf test *.o *.a plugins/kk.o plugins/tt.o plugins/kk.so plugins/tt.so
How can I make make
completely silent? (Please, no make
switches, just code inside the Makefile)
EDIT: Using make 4.0
Upvotes: 0
Views: 418
Reputation: 101051
I think you've got this wrong; I'll bet it's not your clean rule that's printing this.
Those object files are considered "intermediate targets", and as such make is deleting them for you automatically. When it does, it prints that information so you know where they went. The only way to stop that from happening is to define the .SILENT:
special target (or give the -s
flag but you said you didn't want to do that).
Or, you can ensure make doesn't consider those files to be intermediate (and thus not deleting them) by listing them as prerequisites, maybe:
all: $(TARGET) $(PLUGINS_SO) $(PLUGINS_O)
Upvotes: 3