From ef89207c8dbcf112955e87add13130498c24feb2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 15 Nov 2017 07:09:16 -0600 Subject: [PATCH] Build system: Fix CONFIG_BUILD_KERNEL logic directories that have ubin and kbin subdirectories. Conditional logic was fine for CONFIG_BUILD_FLAT and CONFIG_BUILD_PROTECTED but generated useless dependencies if CONFIG_BUILD_KERNEL. --- libc/Makefile | 16 ++++------------ libnx/Makefile | 10 +++++----- mm/Makefile | 10 +++++----- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/libc/Makefile b/libc/Makefile index 41db3b92599..09e3cbd81b1 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -37,20 +37,12 @@ # CFLAGS -ifeq ($(CONFIG_BUILD_PROTECTED),y) +ifneq ($(CONFIG_BUILD_FLAT),y) ifeq ($(CONFIG_WINDOWS_NATIVE),y) KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__} else KDEFINE = ${shell $(TOPDIR)/tools/define.sh "$(CC)" __KERNEL__} endif -else -ifeq ($(CONFIG_BUILD_KERNEL),y) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__} -else - KDEFINE = ${shell $(TOPDIR)/tools/define.sh "$(CC)" __KERNEL__} -endif -endif endif # Sources and paths @@ -154,11 +146,11 @@ endif # Dependencies .depend: Makefile $(SRCS) -ifeq ($(CONFIG_BUILD_PROTECTED),y) +ifeq ($(CONFIG_BUILD_FLAT),y) + $(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep +else $(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep $(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep -else - $(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep endif ifeq ($(CONFIG_LIB_ZONEINFO_ROMFS),y) $(Q) $(MAKE) -C zoneinfo depend TOPDIR=$(TOPDIR) BIN=$(BIN) diff --git a/libnx/Makefile b/libnx/Makefile index af0da579f42..a34df424899 100644 --- a/libnx/Makefile +++ b/libnx/Makefile @@ -1,7 +1,7 @@ ############################################################################ # libnx/Makefile # -# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -37,7 +37,7 @@ # CFLAGS -ifeq ($(CONFIG_BUILD_PROTECTED),y) +ifneq ($(CONFIG_BUILD_FLAT),y) ifeq ($(CONFIG_WINDOWS_NATIVE),y) KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__} else @@ -261,11 +261,11 @@ endif # Dependencies .depend: Makefile gensources $(SRCS) -ifeq ($(CONFIG_BUILD_PROTECTED),y) +ifeq ($(CONFIG_BUILD_FLAT),y) + $(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep +else $(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep $(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep -else - $(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep endif $(Q) touch $@ diff --git a/mm/Makefile b/mm/Makefile index 6126ea1c64d..a0eeeb1a213 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -1,7 +1,7 @@ ############################################################################ # mm/Makefile # -# Copyright (C) 2007, 2012, 2013-2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2007, 2012, 2013-2014, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -40,7 +40,7 @@ DELIM := $(strip /) # CFLAGS -ifeq ($(CONFIG_BUILD_PROTECTED),y) +ifneq ($(CONFIG_BUILD_FLAT),y) ifeq ($(CONFIG_WINDOWS_NATIVE),y) KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__} else @@ -108,11 +108,11 @@ endif # Dependencies .depend: Makefile $(SRCS) -ifeq ($(CONFIG_BUILD_PROTECTED),y) +ifeq ($(CONFIG_BUILD_FLAT),y) + $(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep +else $(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep $(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep -else - $(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep endif $(Q) touch $@