From 29e8b8e059a9ba4bb1d3bebd71296d285bb0269a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 10 May 2016 15:40:20 -0600 Subject: [PATCH] Several Makefiles: Add .PHONY definitions to prevent 'clean up to date' message weirdness; Add default definitions for some commonly used things when 'make clean' is used without .config or Make.defs files installed. --- ChangeLog.txt | 4 ++++ examples/elf/tests/errno/Makefile | 6 +++++- examples/elf/tests/hello/Makefile | 6 +++++- examples/elf/tests/helloxx/Makefile | 6 +++++- examples/elf/tests/longjmp/Makefile | 6 +++++- examples/elf/tests/mutex/Makefile | 6 +++++- examples/elf/tests/pthread/Makefile | 6 +++++- examples/elf/tests/signal/Makefile | 6 +++++- examples/elf/tests/struct/Makefile | 6 +++++- examples/elf/tests/task/Makefile | 6 +++++- examples/module/Makefile | 6 +++++- examples/module/drivers/chardev/Makefile | 6 +++++- .../posix_spawn/filesystem/hello/Makefile | 3 ++- .../posix_spawn/filesystem/redirect/Makefile | 3 ++- examples/thttpd/content/hello/Makefile | 13 +++++++------ examples/thttpd/content/netstat/Makefile | 13 +++++++------ examples/thttpd/content/tasks/Makefile | 16 ++++++++++------ examples/usbserial/Makefile | 2 +- examples/usbserial/Makefile.host | 19 ++++++++++--------- interpreters/micropython/Makefile | 3 ++- platform/Makefile | 6 ++++-- 21 files changed, 104 insertions(+), 44 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 50854b7c0..f5f8f8374 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1585,3 +1585,7 @@ greyscale. * apps/canutils/uavcan: Update UAVCAN version. From Paul Alexander Patience (2016-05-03) + * Several Makefiles: Add .PHONY definitions to prevent 'clean up to date' + message weirdness; Add default definitions for some commonly used + things when 'make clean' is used without .config or Make.defs files + installed (2016-05-10). diff --git a/examples/elf/tests/errno/Makefile b/examples/elf/tests/errno/Makefile index 89e3f2bfd..6b2d4e0b4 100644 --- a/examples/elf/tests/errno/Makefile +++ b/examples/elf/tests/errno/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/errno/Makefile # -# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -69,6 +72,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/elf/tests/hello/Makefile b/examples/elf/tests/hello/Makefile index f89759a66..28ad22211 100644 --- a/examples/elf/tests/hello/Makefile +++ b/examples/elf/tests/hello/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/hello/Makefile # -# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -69,6 +72,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/elf/tests/helloxx/Makefile b/examples/elf/tests/helloxx/Makefile index 4ab072a21..135bbd1b8 100644 --- a/examples/elf/tests/helloxx/Makefile +++ b/examples/elf/tests/helloxx/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/helloxx/Makefile # -# Copyright (C) 2012, 2014-2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014-2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -98,6 +101,7 @@ LDLIBSTDC_STUBS_DIR = $(TOPDIR)/libxx LDLIBSTDC_STUBS_LIB = $(LDLIBSTDC_STUBS_DIR)/liblibxx.a all: $(BIN1) $(BIN2) $(BIN3) $(BIN4) $(BIN5) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.cpp @echo "CC: $<" diff --git a/examples/elf/tests/longjmp/Makefile b/examples/elf/tests/longjmp/Makefile index 26fa393bd..da76c2dbb 100644 --- a/examples/elf/tests/longjmp/Makefile +++ b/examples/elf/tests/longjmp/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/longjmp/Makefile # -# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -69,6 +72,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/elf/tests/mutex/Makefile b/examples/elf/tests/mutex/Makefile index f8ce4f613..865ccf497 100644 --- a/examples/elf/tests/mutex/Makefile +++ b/examples/elf/tests/mutex/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/mutex/Makefile # -# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -69,6 +72,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/elf/tests/pthread/Makefile b/examples/elf/tests/pthread/Makefile index 9d4ce496b..370dab604 100644 --- a/examples/elf/tests/pthread/Makefile +++ b/examples/elf/tests/pthread/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/pthread/Makefile # -# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -69,6 +72,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/elf/tests/signal/Makefile b/examples/elf/tests/signal/Makefile index c442ae9c6..22b1185d5 100644 --- a/examples/elf/tests/signal/Makefile +++ b/examples/elf/tests/signal/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/signal/Makefile # -# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -69,6 +72,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/elf/tests/struct/Makefile b/examples/elf/tests/struct/Makefile index 8fe7cf710..8045ed386 100644 --- a/examples/elf/tests/struct/Makefile +++ b/examples/elf/tests/struct/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/struct/Makefile # -# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + CELFFLAGS += -I. ifeq ($(WINTOOL),y) @@ -70,6 +73,7 @@ SRCS = struct_main.c struct_dummy.c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/elf/tests/task/Makefile b/examples/elf/tests/task/Makefile index 572d1072e..88289fcc6 100644 --- a/examples/elf/tests/task/Makefile +++ b/examples/elf/tests/task/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/task/Makefile # -# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -69,6 +72,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/module/Makefile b/examples/module/Makefile index f869adf30..680b6e58c 100644 --- a/examples/module/Makefile +++ b/examples/module/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/module/Makefile # -# Copyright (C) 2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,10 @@ -include $(TOPDIR)/.config -include $(TOPDIR)/Make.defs + +OBJEXT ?= .o +DELIM ?= / + include $(APPDIR)/Make.defs # Module example built-in application info diff --git a/examples/module/drivers/chardev/Makefile b/examples/module/drivers/chardev/Makefile index 256e5821f..67ae38255 100644 --- a/examples/module/drivers/chardev/Makefile +++ b/examples/module/drivers/chardev/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/module/drivers/chardev/Makefile # -# Copyright (C) 2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,9 @@ -include $(TOPDIR)/Make.defs +OBJEXT ?= .o +DELIM ?= / + ifeq ($(WINTOOL),y) NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)lib}" else @@ -71,6 +74,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=$(OBJEXT)) all: $(BIN) +.PHONY: clean install $(OBJS): %$(OBJEXT): %.c @echo "CC: $<" diff --git a/examples/posix_spawn/filesystem/hello/Makefile b/examples/posix_spawn/filesystem/hello/Makefile index 4097c6f86..728f49904 100644 --- a/examples/posix_spawn/filesystem/hello/Makefile +++ b/examples/posix_spawn/filesystem/hello/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/elf/tests/hello/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=.o) all: $(BIN) +.PHONY: clean install $(OBJS): %.o: %.c @echo "CC: $<" diff --git a/examples/posix_spawn/filesystem/redirect/Makefile b/examples/posix_spawn/filesystem/redirect/Makefile index c6259d819..fa1a9a818 100644 --- a/examples/posix_spawn/filesystem/redirect/Makefile +++ b/examples/posix_spawn/filesystem/redirect/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/posix_spawn/filesystem/redirect/Makefile # -# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ SRCS = $(BIN).c OBJS = $(SRCS:.c=.o) all: $(BIN) +.PHONY: clean install $(OBJS): %.o: %.c @echo "CC: $<" diff --git a/examples/thttpd/content/hello/Makefile b/examples/thttpd/content/hello/Makefile index 2856490ab..046684981 100644 --- a/examples/thttpd/content/hello/Makefile +++ b/examples/thttpd/content/hello/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/thttpd/content/hello/Makefile # -# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Copyright (C) 2009, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,15 +35,16 @@ -include $(TOPDIR)/Make.defs -BIN = hello +BIN = hello -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) +.PHONY: clean install $(R1OBJS): %.o: %.c @echo "CC: $<" diff --git a/examples/thttpd/content/netstat/Makefile b/examples/thttpd/content/netstat/Makefile index 6d89bcd88..9b8c84b9c 100644 --- a/examples/thttpd/content/netstat/Makefile +++ b/examples/thttpd/content/netstat/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/thttpd/content/netstat/Makefile # -# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Copyright (C) 2009, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,15 +35,16 @@ -include $(TOPDIR)/Make.defs -BIN = netstat +BIN = netstat -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) +.PHONY: clean install $(R1OBJS): %.o: %.c @echo "CC: $<" diff --git a/examples/thttpd/content/tasks/Makefile b/examples/thttpd/content/tasks/Makefile index 418fca2b3..0754b1ed4 100644 --- a/examples/thttpd/content/tasks/Makefile +++ b/examples/thttpd/content/tasks/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/thttpd/content/tasks/Makefile # -# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Copyright (C) 2009, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,15 +35,19 @@ -include $(TOPDIR)/Make.defs -BIN = tasks +OBJEXT ?= .o +DELIM ?= / -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) +BIN = tasks -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) +.PHONY: clean install $(R1OBJS): %.o: %.c @echo "CC: $<" diff --git a/examples/usbserial/Makefile b/examples/usbserial/Makefile index f7d0b9602..3b8444449 100644 --- a/examples/usbserial/Makefile +++ b/examples/usbserial/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/usbserial/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2012, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without diff --git a/examples/usbserial/Makefile.host b/examples/usbserial/Makefile.host index c6ebf54e5..6abf77966 100644 --- a/examples/usbserial/Makefile.host +++ b/examples/usbserial/Makefile.host @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/usbserial/Makefile.host # -# Copyright (C) 2008, 2011, 2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2011, 2015-2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -37,27 +37,28 @@ -include $(TOPDIR)/Make.defs -SRC = host.c -BIN = host$(EXEEXT) +SRC = host.c +BIN = host$(EXEEXT) -DEFINES = +DEFINES = ifeq ($(CONFIG_EXAMPLES_USBSERIAL_INONLY),y) -DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_INONLY=1 +DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_INONLY=1 endif ifeq ($(CONFIG_EXAMPLES_USBSERIAL_OUTONLY),y) -DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_OUTONLY=1 +DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_OUTONLY=1 endif ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL),y) -DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=1 +DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=1 endif ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG),y) -DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYBIG=1 +DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYBIG=1 endif ifeq ($(CONFIG_CDCACM),y) -DEFINES += -DCONFIG_CDCACM=1 +DEFINES += -DCONFIG_CDCACM=1 endif all: $(BIN) +.PHONY: clean $(BIN): $(SRC) @$(HOSTCC) $(HOSTCFLAGS) $(DEFINES) $^ -o $@ diff --git a/interpreters/micropython/Makefile b/interpreters/micropython/Makefile index fec76d913..7c9fe19ed 100644 --- a/interpreters/micropython/Makefile +++ b/interpreters/micropython/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/ interpreters/micropython/Makefile # -# Copyright (C) 2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved. # Authors: Gregory Nutt # Dave Marples # @@ -127,6 +127,7 @@ ROOTDEPPATH = --dep-path . # Common build all: .built +.PHONY: install context clean distclean $(MICROPYTHON_TARBALL): @echo "Downloading: $(MICROPYTHON_TARBALL)" diff --git a/platform/Makefile b/platform/Makefile index 0e811ffc7..58e9dc50a 100644 --- a/platform/Makefile +++ b/platform/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/platform/Makefile # -# Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -96,7 +96,7 @@ endif # Build targets all: .built -.PHONY: context .depend depend clean distclean +.PHONY: $(TOPDIR)$(DELIM).config context .depend depend clean distclean ifneq ($(ASRCS),) $(AOBJS): bin$(DELIM)%$(OBJEXT): %.S @@ -116,6 +116,8 @@ endif # Build context setup +$(TOPDIR)$(DELIM).config: + $(PLATFORMDIR): $(TOPDIR)$(DELIM).config @echo "LN: platform$(DELIM)board to $(LINKDIR)" $(Q) $(DIRUNLINK) $(PLATFORMDIR)