Commit cbde0b13 authored by Andrew Price's avatar Andrew Price
Browse files

Hide the .d files

Use -MF to make gcc output the autogenerated rules into dotfiles so that
they don't clutter up listings.
parent d3854192
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -86,21 +86,26 @@ else
MWCFLAGS += -O0 -Werror
endif

### The magic which lets us autogenerate dependencies
CFLAGS = $(MWCFLAGS) -MMD
LDFLAGS = $(MWLDFLAGS)
# Let the user add some flags at the end
CFLAGS_APPEND =

CFLAGS = $(MWCFLAGS) $(CFLAGS_APPEND)
LDFLAGS = $(MWLDFLAGS)

CODE=$(wildcard *.c)
HDRS=$(wildcard *.h)

all: build

# Using -MMD -MF <filename> outputs make rules for the required .o into
# <filename> with automatically generated dependencies on the .c file and the
# local headers included by the .c file
%.o: %.c
	$(CC) $(CFLAGS) $(CFLAGS_APPEND) -c -o $@ $<
	$(CC) $(CFLAGS) -MMD -MF .$(@:.o=.d) -c -o $@ $<

-include $(CODE:.c=.d)
# The generated rule for the requested .o file is then included, dependencies
# are checked and the rule is executed without the -M* options.
-include $(CODE:%.c=.%.d)

$(JSOBJ):
	$(MAKE) -C $(SRCROOT)/mozjs libdir=/usr/lib
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ install: all
	install -d $(DESTDIR)$(STATEDIR)

clean:
	-rm -f *.o *.d nonce-def.h mw mwserv libmw.a
	-rm -f *.o *.d .*.d nonce-def.h mw mwserv libmw.a

cleanall: clean
	$(MAKE) -C client clean
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ install: mw
	install -D mw $(DESTDIR)$(bindir)/mw

clean:
	-rm -f *.o *.d mw
	-rm -f *.o .*.d *.d mw

ifndef TESTDIR
test:
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ mwserv: $(CODE:.c=.o) ../libmw.a $(JSOBJ)
	$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^

clean:
	-rm -f *.o *.d mwserv
	-rm -f *.o .*.d *.d mwserv

install: mwserv
	install -D mwserv $(DESTDIR)$(HOMEPATH)/mwserv
+1 −1
Original line number Diff line number Diff line
@@ -22,4 +22,4 @@ sizes: sizes.o
	$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^

clean:
	rm -f *.o *.d listuser fixuser del_user sizes
	rm -f *.o .*.d *.d listuser fixuser del_user sizes
Loading