aboutsummaryrefslogtreecommitdiffstats
path: root/dos/Makefile
blob: b2b698303232f9bc9e722aa4bb31da15215381e4 (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
CC	 = gcc -m32 -mregparm=3
LD       = ld -m elf_i386
OBJCOPY  = objcopy
OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer
INCLUDES = -include code16.h -I. -I.. -I../libfat
CFLAGS	 = -W -Wall -ffreestanding $(OPTFLAGS) $(INCLUDES)
LDFLAGS	 = -T com16.ld

SRCS     = syslinux.c conio.c skipatou.c atou.c malloc.c free.c \
	   ../syslxmod.c ../bootsect_bin.c ../ldlinux_bin.c \
           $(wildcard ../libfat/*.c)
OBJS	 = crt0.o memcpy.o memset.o $(patsubst %.c,%.o,$(notdir $(SRCS)))

.SUFFIXES: .c .o .i .s .S .elf .com

VPATH = .:..:../libfat

all: installer

tidy:
	-rm -f *.o *.i *.s *.a .*.d *.elf

clean: tidy
	-rm -f syslinux.com

spotless: clean
	-rm -f *~

installer: syslinux.com

syslinux.elf: $(OBJS)
	$(LD) $(LDFLAGS) -o $@ $^

syslinux.com: syslinux.elf
	$(OBJCOPY) -O binary $< $@

%.o: %.c
	$(CC) -Wp,-MT,$@,-MD,.$@.d $(CFLAGS) -c -o $@ $<
%.i: %.c
	$(CC) $(CFLAGS) -E -o $@ $<
%.s: %.c
	$(CC) $(CFLAGS) -S -o $@ $<
%.s: %.S
	$(CC) $(CFLAGS) -D__ASSEMBLY__ -S -o $@ $<

-include .*.d