chdir: collapse /./ and /../ in path for conventional filesystems
[profile/ivi/syslinux.git] / memdump / Makefile
1 ## -----------------------------------------------------------------------
2 ##
3 ##   Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
4 ##
5 ##   This program is free software; you can redistribute it and/or modify
6 ##   it under the terms of the GNU General Public License as published by
7 ##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ##   Boston MA 02111-1307, USA; either version 2 of the License, or
9 ##   (at your option) any later version; incorporated herein by reference.
10 ##
11 ## -----------------------------------------------------------------------
12
13 ##
14 ## memory dump utility
15 ##
16
17 topdir = ..
18 MAKEDIR = $(topdir)/mk
19 include $(MAKEDIR)/embedded.mk
20
21 OPTFLAGS = 
22 INCLUDES = -include code16.h -I.
23 LDFLAGS  = -T com16.ld
24
25 SRCS     = main.c serial.c ymsend.c srecsend.c
26 OBJS     = crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
27 LIBOBJS  = conio.o memcpy.o memset.o skipatou.o strtoul.o \
28            argv.o printf.o __divdi3.o __udivmoddi4.o
29
30 .SUFFIXES: .c .o .i .s .S .elf .com
31
32 TARGETS = memdump.com
33
34 all: $(TARGETS)
35
36 tidy dist:
37         -rm -f *.o *.i *.s *.a .*.d *.tmp *.elf
38
39 clean: tidy
40
41 spotless: clean
42         -rm -f *~ $(TARGETS)
43
44 installer:
45
46 memdump.elf: $(OBJS) libcom.a
47         $(LD) $(LDFLAGS) -o $@ $^
48
49 libcom.a: $(LIBOBJS)
50         -rm -f $@
51         $(AR) cq $@ $^
52         $(RANLIB) $@
53
54 memdump.com: memdump.elf
55         $(OBJCOPY) -O binary $< $@
56
57 %.o: %.c
58         $(CC) $(MAKEDEPS) $(CFLAGS) -c -o $@ $<
59 %.i: %.c
60         $(CC) $(MAKEDEPS) $(CFLAGS) -E -o $@ $<
61 %.s: %.c
62         $(CC) $(MAKEDEPS) $(CFLAGS) -S -o $@ $<
63 %.o: %.S
64         $(CC) $(MAKEDEPS) $(SFLAGS) -c -o $@ $<
65 %.s: %.S
66         $(CC) $(MAKEDEPS) $(SFLAGS) -E -o $@ $<
67
68 -include .*.d *.tmp