summaryrefslogtreecommitdiff
path: root/hello_world_ada/Makefile.pc386
blob: 1aac9dfbef6903e6843148866fda3beb0586b202 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#
#  Makefile for hello world example
#

MAIN=hello

# Tool paths
target=i386-rtems
tooldir=/home/joel/gnat-3.10p/${target}/
rtemsdir=${tooldir}/rtems/pc386

# Tool names
GCC=${tooldir}/bin/${target}-gcc
GNATMAKE=${tooldir}/bin/${target}-gnatmake
SIZE=${tooldir}/bin/${target}-size
OBJCOPY=${tooldir}/bin/${target}-objcopy
NM=${tooldir}/bin/${target}-nm

HEADERADDR=0x00097E00
START16FILE=$(rtemsdir)/lib/start16.bin
START16ADDR=0x00097C00
RELOCADDR=0x00100000

CARGS=-B${rtemsdir}/lib/ -specs bsp_specs -qrtems \
   -Wl,-Ttext,$(RELOCADDR) -Wl,--oformat,elf32-i386

all: init.o $(MAIN)

$(MAIN): $(MAIN).exe
	ln $(MAIN).exe $(MAIN)

$(MAIN).exe: init.o
	$(GNATMAKE) -v -O -gnata -gnatE -gnato $(MAIN) -g -o $(MAIN).obj \
	    -bargs -r \
	    -cargs $(CARGS) \
	    -largs $(CARGS) init.o
	$(SIZE) $(MAIN).obj
	$(NM) -g -n $(MAIN).obj >$(MAIN).num
	$(OBJCOPY) -O a.out-i386 \
            --remove-section=.rodata \
            --remove-section=.comment \
            --remove-section=.note \
            --strip-unneeded $(MAIN).obj $@
	$(OBJCOPY) -O binary $(MAIN).obj $(MAIN).bin
	$(rtemsdir)/build-tools/bin2boot -v $(MAIN).bt $(HEADERADDR) \
          $(START16FILE) $(START16ADDR) 0 $(MAIN).bin $(RELOCADDR) 0


init.o: init.c
	$(GCC) -O4 -g  -Wall -ansi -fasm $(CARGS) \
	    -DGNAT_MAIN_STACKSPACE=16 -c init.c

clean:
	rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN)