summaryrefslogtreecommitdiff
path: root/device/lib/ds400/Makefile.in
blob: f1c9324c36ddd6d0dd600cd2eef5a2a7b1caf9ef (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# libc/ds400 Makefile

VPATH  = @srcdir@
srcdir = @srcdir@
top_builddir = @top_builddir@

LIB_TYPE     = @LIB_TYPE@

CC = $(top_builddir)/bin/sdcc

# override PORTDIR defined by super (parent) makefile
override PORTDIR = ../build/ds400

#VERBOSE = --verbose

OBJECTS = tinibios.rel memcpyx.rel ds400rom.rel

SOURCES = $(patsubst %.rel,%.c,$(OBJECTS))

CPPFLAGS = -I$(srcdir)/../../include -I$(srcdir)/../../include/ds400
CFLAGS = -mds400 $(CPPFLAGS) $(VERBOSE) --std-c11

all: $(OBJECTS) $(PORTDIR)/libds400.lib

clean:
	rm -f *.lst *.rel *.sym *.cdb *.asm \#* *~ *.rst *.hex 
	rm -f *.ihx temp.lnk *.map *.lib

distclean: clean
	rm -f Makefile Makefile.dep

$(PORTDIR)/libds400.lib: $(OBJECTS)
ifeq ($(LIB_TYPE), SDCCLIB)
	rm -f $@; \
	$(top_builddir)/bin/sdcclib -a $@ $(OBJECTS)
else
  ifeq ($(LIB_TYPE), AR)
	$(top_builddir)/bin/sdar -rcSD $@ $(OBJECTS)
  else
    ifeq ($(LIB_TYPE), RANLIB)
	$(top_builddir)/bin/sdar -rcD $@ $(OBJECTS)
    else
	rm -f $@;
	for libfile in $(basename $(OBJECTS)); do echo $$libfile >>$@; done
	cp $(OBJECTS) $(PORTDIR)
    endif
  endif
endif

%.rel: %.c
	$(CC) -c $(CFLAGS) $<

# Creating dependencies
# ---------------------
depend: Makefile.dep

Makefile.dep: $(SOURCES)
	rm -f Makefile.dep
	for i in $^; do \
	  $(CC) -M $(CPPFLAGS) $$i >$${i}.dep; \
	  cat $${i}.dep >>Makefile.dep; \
	  rm $${i}.dep; \
	done

ifeq "$(findstring $(MAKECMDGOALS),clean distclean)" ""
  -include Makefile.dep
endif