summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80e398a)
raw | patch | inline | side by side (parent: 80e398a)
author | Nishanth Menon <nm@ti.com> | |
Tue, 1 Sep 2015 22:21:30 +0000 (17:21 -0500) | ||
committer | Nishanth Menon <nm@ti.com> | |
Fri, 2 Oct 2015 03:54:47 +0000 (22:54 -0500) |
With this change the object files can be routed as necessary
Now, we can do make O=<some_path> and build objects there.
By default, we now start building the objects in corresponding SoC
specific directories.
Signed-off-by: Nishanth Menon <nm@ti.com>
Now, we can do make O=<some_path> and build objects there.
By default, we now start building the objects in corresponding SoC
specific directories.
Signed-off-by: Nishanth Menon <nm@ti.com>
Makefile | patch | blob | history | |
make.rules | patch | blob | history | |
non-sec/Makefile | patch | blob | history | |
non-sec/nonsec.lds | patch | blob | history | |
sec/Makefile | patch | blob | history | |
sec/s-kernel.lds | patch | blob | history |
diff --git a/Makefile b/Makefile
index 1791afbce113fa04b993118580ae0c184c93d49b..c05558500d3bc9a9554b7e54097b2a07c07afe51 100644 (file)
--- a/Makefile
+++ b/Makefile
SECPADBIN = sec/s-kernel_pad.bin
IMAGE = skern
+ifneq ($(O),)
+export OBJROOT=$(O)
+endif
BOOTROM_VERSION = 1
diff --git a/make.rules b/make.rules
index 07b597bf140079c37ebb7a90adb5e9582dadb507..ad1fa5ab5815b24c86f94c4a449b19910cb3e0ea 100644 (file)
--- a/make.rules
+++ b/make.rules
# * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# *
# */
-.PHONY: all clean
-all: $(EXE).bin $(EXE)_pad.bin
+.PHONY: all clean build_dir image
+
+OBJROOT ?= $(ROOT)
+OBJDIR ?= $(OBJROOT)/soc/$(SOC)
+OBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(CSOURCES))
+OBJS += $(patsubst %.S,$(OBJDIR)/%.o,$(ASOURCES))
+
+all: build_dir image
+
+image: $(EXE).bin $(EXE)_pad.bin
$(EXE)_pad.bin: $(EXE).bin
objcopy -I binary -O binary --gap-fill 0x00 --pad-to $(PADSIZE) $< $@
clean:
rm -rf $(OBJS) *.bin *.out *.map
+
+build_dir:
+ if test ! -d $(OBJDIR); then \
+ mkdir -p $(OBJDIR) ;\
+ fi
+
+$(OBJDIR)/%.o: %.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
+
+$(OBJDIR)/%.o: %.S
+ $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c -o $@ $<
diff --git a/non-sec/Makefile b/non-sec/Makefile
index 44497cb8cba4b4f7a6a460ff1af1a3e523ad7b0e..770e11791c39de9487e3f6032f68d2a85d67f937 100644 (file)
--- a/non-sec/Makefile
+++ b/non-sec/Makefile
PADSIZE = $(NONSEC_IMAGE_SIZE)
-OBJS = init.o
+ASOURCES = init.S
EXE = nonsec
diff --git a/non-sec/nonsec.lds b/non-sec/nonsec.lds
index 307791b32860e75bab569ba77642c60a25006617..134f3bdd5e8bde4c8788905a5433b418384eb912 100644 (file)
--- a/non-sec/nonsec.lds
+++ b/non-sec/nonsec.lds
__start__ = . ;
.text :
{
- init.o (.text)
+ *init.o (.text)
*(.text .stub .text.* .gnu.linkonce.t.*)
} =0
PROVIDE (__etext = .);
diff --git a/sec/Makefile b/sec/Makefile
index f9436c30d25b3d3672ee9115a6fd018f1475d527..44474ffea31c117506ad03635c294f668753896e 100644 (file)
--- a/sec/Makefile
+++ b/sec/Makefile
PADSIZE = $(SEC_IMAGE_SIZE)
-OBJS = skern.o skernel.o debug.o
+CSOURCES = skern.c debug.c
+ASOURCES = skernel.S
EXE = s-kernel
diff --git a/sec/s-kernel.lds b/sec/s-kernel.lds
index 549ef05db30e5241ad48253ce1c9f6393850b8c4..50a9c82decb981c9b991c21df395fb0805851736 100644 (file)
--- a/sec/s-kernel.lds
+++ b/sec/s-kernel.lds
__start__ = . ;
.text :
{
- skernel.o (.text)
- skern.o (.text)
+ *skernel.o (.text)
+ *skern.o (.text)
*(.text .stub .text.* .gnu.linkonce.t.*)
} =0
PROVIDE (__etext = .);