summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2016-12-16 19:39:07 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2016-12-16 19:46:07 +0100
commit6f4beaa52c33737f8ffd9047af2d9fe2fb168a1e (patch)
tree78eae9901e5c08ccd21831ce54da3a985c086626
parentefe3775145fc31ca5fc88f44fbd92264f0a489be (diff)
downloadrockbox-6f4beaa52c33737f8ffd9047af2d9fe2fb168a1e.tar.gz
rockbox-6f4beaa52c33737f8ffd9047af2d9fe2fb168a1e.zip
Don't add LIBSOURCES to SOURCES.
Split source files for library and stand-alone binary and use library as dependency when building the stand-alone binary. This avoids dependencies getting added multiple times. Remove outdated RBARCH handling, we always create fat binaries on OS X these days. Change-Id: Ia15a731296edcbe90869a1bf66dda2c3d6c7e317
-rw-r--r--rbutil/chinachippatcher/Makefile2
-rw-r--r--rbutil/ipodpatcher/Makefile2
-rw-r--r--rbutil/libtools.make25
-rw-r--r--rbutil/mkamsboot/Makefile4
-rw-r--r--rbutil/mkmpioboot/Makefile2
-rw-r--r--rbutil/mktccboot/Makefile2
-rw-r--r--rbutil/mkzenboot/Makefile2
-rw-r--r--rbutil/sansapatcher/Makefile2
8 files changed, 17 insertions, 24 deletions
diff --git a/rbutil/chinachippatcher/Makefile b/rbutil/chinachippatcher/Makefile
index cdce19814d..c8defcb5c4 100644
--- a/rbutil/chinachippatcher/Makefile
+++ b/rbutil/chinachippatcher/Makefile
@@ -11,7 +11,7 @@ CFLAGS += -g -Wall
11OUTPUT = chinachippatcher 11OUTPUT = chinachippatcher
12 12
13LIBSOURCES = chinachip.c 13LIBSOURCES = chinachip.c
14SOURCES = $(LIBSOURCES) main.c 14SOURCES = main.c
15 15
16include ../libtools.make 16include ../libtools.make
17 17
diff --git a/rbutil/ipodpatcher/Makefile b/rbutil/ipodpatcher/Makefile
index 382423b4f2..4254995d22 100644
--- a/rbutil/ipodpatcher/Makefile
+++ b/rbutil/ipodpatcher/Makefile
@@ -32,7 +32,7 @@ LDOPTS_OSX = -framework CoreFoundation -framework IOKit
32 32
33LIBSOURCES = ipodpatcher.c fat32format.c arc4.c \ 33LIBSOURCES = ipodpatcher.c fat32format.c arc4.c \
34 ipodio-posix.c ipodio-win32-scsi.c ipodio-win32.c 34 ipodio-posix.c ipodio-win32-scsi.c ipodio-win32.c
35SOURCES = main.c $(BOOTSRC) $(LIBSOURCES) 35SOURCES = main.c $(BOOTSRC)
36ipodpatcher: SOURCES+= ipodio-posix.c 36ipodpatcher: SOURCES+= ipodio-posix.c
37 37
38OUTPUT = ipodpatcher 38OUTPUT = ipodpatcher
diff --git a/rbutil/libtools.make b/rbutil/libtools.make
index 7a125f98ea..c107e69bfd 100644
--- a/rbutil/libtools.make
+++ b/rbutil/libtools.make
@@ -37,8 +37,6 @@ TARGET_DIR ?= $(abspath .)/
37NATIVECC ?= gcc 37NATIVECC ?= gcc
38CC ?= gcc 38CC ?= gcc
39CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -) 39CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -)
40# use POSIX/C99 printf on windows
41CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
42 40
43BINARY = $(OUTPUT) 41BINARY = $(OUTPUT)
44# when building a Windows binary add the correct file suffix 42# when building a Windows binary add the correct file suffix
@@ -50,6 +48,8 @@ else
50ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW) 48ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW)
51BINARY = $(OUTPUT).exe 49BINARY = $(OUTPUT).exe
52COMPILETARGET = mingw 50COMPILETARGET = mingw
51# use POSIX/C99 printf on windows
52CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
53else 53else
54ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE) 54ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE)
55COMPILETARGET = darwin 55COMPILETARGET = darwin
@@ -79,16 +79,9 @@ CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
79NATIVECC = gcc-4.0 79NATIVECC = gcc-4.0
80endif 80endif
81endif 81endif
82WINDRES = windres
83 82
84BUILD_DIR ?= $(TARGET_DIR)build$(COMPILETARGET) 83BUILD_DIR ?= $(TARGET_DIR)build$(COMPILETARGET)
85
86ifdef RBARCH
87ARCHFLAGS += -arch $(RBARCH)
88OBJDIR = $(abspath $(BUILD_DIR)/$(RBARCH))/
89else
90OBJDIR = $(abspath $(BUILD_DIR))/ 84OBJDIR = $(abspath $(BUILD_DIR))/
91endif
92 85
93all: $(BINARY) 86all: $(BINARY)
94 87
@@ -103,20 +96,20 @@ DEPS = $(addprefix $(OBJDIR),$(subst .c,.d,$(notdir $(SOURCES) $(LIBSOURCES))))
103 96
104# additional link dependencies for the standalone executable 97# additional link dependencies for the standalone executable
105# extra dependencies: libucl 98# extra dependencies: libucl
106LIBUCL = libucl$(RBARCH).a 99LIBUCL = libucl.a
107$(LIBUCL): $(OBJDIR)$(LIBUCL) 100$(LIBUCL): $(OBJDIR)$(LIBUCL)
108 101
109$(OBJDIR)$(LIBUCL): 102$(OBJDIR)$(LIBUCL):
110 $(SILENT)$(MAKE) -C $(TOP)/../tools/ucl/src TARGET_DIR=$(OBJDIR) $@ 103 $(SILENT)$(MAKE) -C $(TOP)/../tools/ucl/src TARGET_DIR=$(OBJDIR) $@
111 104
112# building the standalone executable 105# building the standalone executable
113$(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) 106$(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(TARGET_DIR)lib$(OUTPUT).a
114 @echo LD $@ 107 @echo LD $@
115 $(SILENT)$(call mkdir,$(dir $@)) 108 $(SILENT)$(call mkdir,$(dir $@))
116# EXTRADEPS need to be built into OBJDIR. 109# EXTRADEPS need to be built into OBJDIR.
117 $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -o $(BINARY) \ 110 $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -o $(BINARY) \
118 $(OBJS) $(addprefix $(OBJDIR),$(EXTRADEPS)) \ 111 $(OBJS) $(addprefix $(OBJDIR),$(EXTRADEPS)) \
119 $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(LDOPTS) 112 $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) lib$(OUTPUT).a $(addprefix $(OBJDIR),$(EXTRADEPS)) $(LDOPTS)
120 113
121# common rules 114# common rules
122$(OBJDIR)%.o: 115$(OBJDIR)%.o:
@@ -125,10 +118,10 @@ $(OBJDIR)%.o:
125 $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -c -o $@ $< 118 $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -c -o $@ $<
126 119
127# lib rules 120# lib rules
128lib$(OUTPUT)$(RBARCH).a: $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a 121lib$(OUTPUT).a: $(TARGET_DIR)lib$(OUTPUT).a
129lib$(OUTPUT)$(RBARCH): $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a 122lib$(OUTPUT): $(TARGET_DIR)lib$(OUTPUT).a
130 123
131$(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a: $(LIBOBJS) \ 124$(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) \
132 $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) 125 $(addprefix $(OBJDIR),$(EXTRALIBOBJS))
133# rules to build a DLL. Only works for W32 as target (i.e. MinGW toolchain) 126# rules to build a DLL. Only works for W32 as target (i.e. MinGW toolchain)
134dll: $(OUTPUT).dll 127dll: $(OUTPUT).dll
@@ -140,7 +133,7 @@ $(TARGET_DIR)$(OUTPUT).dll: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS))
140 -Wl,--output-def,$(TARGET_DIR)$(OUTPUT).def 133 -Wl,--output-def,$(TARGET_DIR)$(OUTPUT).def
141 134
142# create lib file from objects 135# create lib file from objects
143$(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) 136$(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS))
144 @echo AR $(notdir $@) 137 @echo AR $(notdir $@)
145 $(SILENT)$(call mkdir,$(dir $@)) 138 $(SILENT)$(call mkdir,$(dir $@))
146 $(SILENT)$(call rm,$@) 139 $(SILENT)$(call rm,$@)
diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile
index 67fe91e51d..7100bd9512 100644
--- a/rbutil/mkamsboot/Makefile
+++ b/rbutil/mkamsboot/Makefile
@@ -9,11 +9,11 @@
9CFLAGS += -I../../tools/ucl/include -Wall 9CFLAGS += -I../../tools/ucl/include -Wall
10 10
11OUTPUT = mkamsboot 11OUTPUT = mkamsboot
12LIBUCL = libucl$(RBARCH).a 12LIBUCL = libucl.a
13 13
14# inputs 14# inputs
15LIBSOURCES := dualboot.c md5.c mkamsboot.c 15LIBSOURCES := dualboot.c md5.c mkamsboot.c
16SOURCES := $(LIBSOURCES) main.c 16SOURCES := main.c
17# additional link dependencies for the standalone executable 17# additional link dependencies for the standalone executable
18EXTRADEPS := $(LIBUCL) 18EXTRADEPS := $(LIBUCL)
19 19
diff --git a/rbutil/mkmpioboot/Makefile b/rbutil/mkmpioboot/Makefile
index 0a42e39217..8aa2d37028 100644
--- a/rbutil/mkmpioboot/Makefile
+++ b/rbutil/mkmpioboot/Makefile
@@ -13,7 +13,7 @@ OUTPUT = mkmpioboot
13 13
14# inputs 14# inputs
15LIBSOURCES = mkmpioboot.c 15LIBSOURCES = mkmpioboot.c
16SOURCES = $(LIBSOURCES) main.c 16SOURCES = main.c
17EXTRADEPS = $(LIBUCL) 17EXTRADEPS = $(LIBUCL)
18 18
19include ../libtools.make 19include ../libtools.make
diff --git a/rbutil/mktccboot/Makefile b/rbutil/mktccboot/Makefile
index df49c6977d..4943a8c568 100644
--- a/rbutil/mktccboot/Makefile
+++ b/rbutil/mktccboot/Makefile
@@ -16,7 +16,7 @@ OUTPUT = mktccboot
16 16
17# inputs 17# inputs
18LIBSOURCES := mktccboot.c $(TOOLSDIR)telechips.c 18LIBSOURCES := mktccboot.c $(TOOLSDIR)telechips.c
19SOURCES := $(LIBSOURCES) main.c 19SOURCES := main.c
20EXTRADEPS := 20EXTRADEPS :=
21 21
22include ../libtools.make 22include ../libtools.make
diff --git a/rbutil/mkzenboot/Makefile b/rbutil/mkzenboot/Makefile
index 019b8a669f..ebc7a1670a 100644
--- a/rbutil/mkzenboot/Makefile
+++ b/rbutil/mkzenboot/Makefile
@@ -19,7 +19,7 @@ LIBSOURCES := dualboot.c mkzenboot.c md5.c utils.c \
19 $(addprefix $(TOOLS_DIR),$(TOOLS_SOURCES)) 19 $(addprefix $(TOOLS_DIR),$(TOOLS_SOURCES))
20 20
21# inputs for binary only 21# inputs for binary only
22SOURCES := $(LIBSOURCES) main.c 22SOURCES := main.c
23# dependencies for binary 23# dependencies for binary
24EXTRADEPS := 24EXTRADEPS :=
25 25
diff --git a/rbutil/sansapatcher/Makefile b/rbutil/sansapatcher/Makefile
index 08af2bb6c8..85c36c6d14 100644
--- a/rbutil/sansapatcher/Makefile
+++ b/rbutil/sansapatcher/Makefile
@@ -12,7 +12,7 @@ OUTPUT = sansapatcher
12 12
13# inputs 13# inputs
14LIBSOURCES := sansapatcher.c sansaio-posix.c sansaio-win32.c 14LIBSOURCES := sansapatcher.c sansaio-posix.c sansaio-win32.c
15SOURCES := $(LIBSOURCES) main.c 15SOURCES := main.c
16# additional link dependencies for the standalone executable 16# additional link dependencies for the standalone executable
17EXTRADEPS := 17EXTRADEPS :=
18 18