summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNishanth Menon2015-09-01 16:41:56 -0500
committerNishanth Menon2015-10-01 22:54:47 -0500
commit80e398ad3176bca9affdb773d14f7bb3c8a8e7d1 (patch)
treeb8e49257528c65d4938e856d539a07e1e0ccb16b
parent170d4d6f075f986ab12cde266905aab4d93321fe (diff)
downloadks2-boot-monitor-80e398ad3176bca9affdb773d14f7bb3c8a8e7d1.tar.gz
ks2-boot-monitor-80e398ad3176bca9affdb773d14f7bb3c8a8e7d1.tar.xz
ks2-boot-monitor-80e398ad3176bca9affdb773d14f7bb3c8a8e7d1.zip
Make.rules: Move common make rules to make.rules
No reason to keep things duplicated when we can create common makefile rules.. Signed-off-by: Nishanth Menon <nm@ti.com>
-rw-r--r--make.rules47
-rw-r--r--non-sec/Makefile18
-rw-r--r--sec/Makefile18
3 files changed, 53 insertions, 30 deletions
diff --git a/make.rules b/make.rules
new file mode 100644
index 000000000000..07b597bf1400
--- /dev/null
+++ b/make.rules
@@ -0,0 +1,47 @@
1# /*
2# * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
3# *
4# * Redistribution and use in source and binary forms, with or without
5# * modification, are permitted provided that the following conditions
6# * are met:
7# *
8# * Redistributions of source code must retain the above copyright
9# * notice, this list of conditions and the following disclaimer.
10# *
11# * Redistributions in binary form must reproduce the above copyright
12# * notice, this list of conditions and the following disclaimer in the
13# * documentation and/or other materials provided with the
14# * distribution.
15# *
16# * Neither the name of Texas Instruments Incorporated nor the names of
17# * its contributors may be used to endorse or promote products derived
18# * from this software without specific prior written permission.
19# *
20# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21# * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22# * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23# * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24# * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25# * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26# * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30# * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31# *
32# */
33.PHONY: all clean
34
35all: $(EXE).bin $(EXE)_pad.bin
36
37$(EXE)_pad.bin: $(EXE).bin
38 objcopy -I binary -O binary --gap-fill 0x00 --pad-to $(PADSIZE) $< $@
39
40$(EXE).bin: $(EXE).out
41 $(BIN) $(BINFLAGS) $< $@
42
43$(EXE).out: $(OBJS)
44 $(LD) $(LDFLAGS) -o $@ $^
45
46clean:
47 rm -rf $(OBJS) *.bin *.out *.map
diff --git a/non-sec/Makefile b/non-sec/Makefile
index 781d335b860b..44497cb8cba4 100644
--- a/non-sec/Makefile
+++ b/non-sec/Makefile
@@ -33,22 +33,10 @@
33ROOT=.. 33ROOT=..
34include $(ROOT)/makedefs 34include $(ROOT)/makedefs
35 35
36PADSIZE = $(NONSEC_IMAGE_SIZE)
37
36OBJS = init.o 38OBJS = init.o
37 39
38EXE = nonsec 40EXE = nonsec
39 41
40.PHONY: all clean 42include $(ROOT)/make.rules
41
42all: $(EXE).bin $(EXE)_pad.bin
43
44$(EXE)_pad.bin:
45 objcopy -I binary -O binary --gap-fill 0x00 --pad-to $(NONSEC_IMAGE_SIZE) $(EXE).bin $(EXE)_pad.bin
46
47$(EXE).bin: $(EXE).out
48 $(BIN) $(BINFLAGS) $< $(EXE).bin
49
50$(EXE).out: $(OBJS)
51 $(LD) $(LDFLAGS) -o $@ $^ -lgcc
52
53clean:
54 rm -rf $(OBJS) *.bin $(EXE).out $(EXE).map $(EXE)_pad.bin
diff --git a/sec/Makefile b/sec/Makefile
index 63c6cf703ed9..f9436c30d25b 100644
--- a/sec/Makefile
+++ b/sec/Makefile
@@ -33,22 +33,10 @@
33ROOT=.. 33ROOT=..
34include $(ROOT)/makedefs 34include $(ROOT)/makedefs
35 35
36PADSIZE = $(SEC_IMAGE_SIZE)
37
36OBJS = skern.o skernel.o debug.o 38OBJS = skern.o skernel.o debug.o
37 39
38EXE = s-kernel 40EXE = s-kernel
39 41
40.PHONY: all clean 42include $(ROOT)/make.rules
41
42all: $(EXE).bin $(EXE)_pad.bin
43
44$(EXE)_pad.bin:
45 objcopy -I binary -O binary --gap-fill 0x00 --pad-to $(SEC_IMAGE_SIZE) $(EXE).bin $(EXE)_pad.bin
46
47$(EXE).bin: $(EXE).out
48 $(BIN) $(BINFLAGS) $< $@
49
50$(EXE).out: $(OBJS)
51 $(LD) $(LDFLAGS) -o $@ $^
52
53clean:
54 rm -rf $(OBJS) $(EXE).bin $(EXE).out $(EXE).map *.bin