summaryrefslogtreecommitdiff
path: root/Makefile.linux
blob: 6809c3645472f70b5ae8cd7d060652e0c51ae767 (plain) (blame)
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
SDIR = ./
ODIR = ./

DEFINES = -DUSE_CLIB -DLINUX -DI486 -DGNU_C -DELF
DEFINESA = -D USE_CLIB -D LINUX -D I486 -D GNU_C -D ELF

all: $(ODIR)_startup.o

$(ODIR)_startup.o: $(ODIR)istartup.o $(ODIR)ifileIO3.o $(ODIR)scon.o $(ODIR)ufileIO2.o $(ODIR)uwrite_heap.o
	ld -r -o $(ODIR)_startup.o $(ODIR)istartup.o $(ODIR)scon.o $(ODIR)ifileIO3.o $(ODIR)ufileIO2.o uwrite_heap.o

$(ODIR)scon.o: $(SDIR)scon.c
#	gcc -c -O $(DEFINES) -o $(ODIR)scon.o $(SDIR)scon.c
	$(CC) -O $(DEFINES) -ffunction-sections -fdata-sections $(SDIR)scon.c -S -o $(ODIR)scon.s
	mv $(ODIR)scon.s $(ODIR)scon.s.copy
	grep -v -w ___main $(ODIR)scon.s.copy > $(ODIR)scon.s
	as $(DEFINES_A) $(ODIR)scon.s -o $(ODIR)scon.o

$(ODIR)ufileIO2.o: $(SDIR)ufileIO2.c
	gcc -c -O $(DEFINES) -ffunction-sections -fdata-sections -o $(ODIR)ufileIO2.o $(SDIR)ufileIO2.c

$(ODIR)istartup.o: $(SDIR)istartup.s
	cp $(ODIR)istartup.s $(ODIR)istartup.cpp
	$(CC) $(DEFINES) -E $(ODIR)istartup.cpp > $(ODIR)istartup.t
	sed s/@// < $(SDIR)/istartup.t > $(ODIR)istartup.a
	as $(DEFINES_A) $(ODIR)istartup.a -o $(ODIR)istartup.o

$(ODIR)ifileIO3.o: $(SDIR)ifileIO3.s
	cp $(ODIR)ifileIO3.s $(ODIR)ifileIO3.cpp
	$(CC) $(DEFINES) -E $(ODIR)ifileIO3.cpp > $(ODIR)ifileIO3.t
	sed s/@// < $(SDIR)/ifileIO3.t > $(ODIR)ifileIO3.a
	as $(DEFINES_A) $(ODIR)ifileIO3.a -o $(ODIR)ifileIO3.o