Skip to content

Commit

Permalink
Makefile.in: Cleanup and refactor dep file generation on behalf of Fr…
Browse files Browse the repository at this point in the history
…eeBSD

- Refactor dep file generation using fancy new GCC feature
- Remove ifneq's around -include, not needed now

Fixes part of smcroute issue #5

Signed-off-by: Joachim Nilsson <[email protected]>
  • Loading branch information
troglobit committed Sep 21, 2014
1 parent d95c58b commit 0e5454e
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@ SMCROUTE_OBJS = smcroute.o mroute-api.o ifvc.o cmdpkt.o ipc.o syslog.o \
udpsock.o mcgroup.o parse-conf.o pidfile.o
OBJS = $(MCSENDER_OBJS) $(SMCROUTE_OBJS)
SRCS = $(OBJS:.o=.c)
DEPS = $(addprefix .,$(SRCS:.c=.d))
DEPS = $(SRCS:.c=.d)
LDLIBS = @LIBS@

# Smart autodependecy generation via GCC -M.
.%.d: %.c
@$(SHELL) -ec "$(CC) -MM $(CFLAGS) $(CPPFLAGS) $< 2>/dev/null \
| sed 's,.*: ,$*.o $@ : ,g' > $@; \
[ -s $@ ] || rm -f $@"

# Override default implicit rules
.c.o:
@printf " CC $@\n"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -MMD -MP -o $@ $<

# Build rules
all: $(EXECS)

install: all
Expand Down Expand Up @@ -55,13 +51,8 @@ clean:
-@$(RM) build.h $(SMCROUTE_OBJS) $(MCSENDER_OBJS) $(EXECS)

distclean: clean
-@$(RM) $(DEPS) *~ .bak DEADJOE semantic.cache *.gdb *.elf core core.*
-@$(RM) *~ .bak DEADJOE semantic.cache *.gdb *.elf core core.* *.d
-@$(RM) config.h Makefile


# Include automatically generated rules
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
-include $(DEPS)
endif
endif

0 comments on commit 0e5454e

Please sign in to comment.