summaryrefslogtreecommitdiff
path: root/xpp/utils/Makefile
blob: d8403336c6960ed4e23fc9a65c6556d25e521d5d (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
PEDANTIC	= -ansi -pedantic -std=c99

CC		= gcc
RANLIB		= ranlib
INSTALL		= install
INSTALL_DATA	= install -m 644

BINDIR    = /usr/sbin
DATADIR   = /usr/share/zaptel
MANDIR    = /usr/share/man/man8
HOTPLUG_USB_DIR = /etc/hotplug/usb

DATA_FILES = $(wildcard ../init_data_*.cmd *.hex) 

CFLAGS		= -g -Wall $(EXTRA_CFLAGS)

TARGETS	= libhexfile.a fpga_load test_parse

all: $(TARGETS)

install: all
	$(INSTALL) -d $(DESTDIR)$(BINDIR)
	$(INSTALL) genzaptelconf fpga_load $(DESTDIR)$(BINDIR)/
	$(INSTALL) -d $(DESTDIR)$(DATADIR)
	$(INSTALL_DATA) $(DATA_FILES) $(DESTDIR)$(DATADIR)/
	$(INSTALL) ../initialize_registers  $(DESTDIR)$(DATADIR)/
	$(INSTALL) -d $(DESTDIR)$(MANDIR)
	$(INSTALL_DATA) fpga_load.8 genzaptelconf.8 $(DESTDIR)$(MANDIR)/
	$(INSTALL) -d $(DESTDIR)$(HOTPLUG_USB_DIR)
	$(INSTALL_DATA) xpp_fxloader.usermap $(DESTDIR)$(HOTPLUG_USB_DIR)/
	$(INSTALL) xpp_fxloader $(DESTDIR)$(HOTPLUG_USB_DIR)/

libhexfile.a: hexfile.o
	$(AR) cru $@ $^
	$(RANLIB) $@

fpga_load: fpga_load.o libhexfile.a
	$(CC) -L. -o $@ $@.o $(EXTRA_LIBS) -lhexfile -lusb

hexfile.o: hexfile.c hexfile.h
	$(CC) $(CFLAGS) $(PEDANTIC) -c $*.c

test_parse.o: test_parse.c hexfile.h
	$(CC) $(CFLAGS) $(PEDANTIC) -c $*.c

test_parse: test_parse.o libhexfile.a
	$(CC) -L. -o $@ $@.o $(EXTRA_LIBS) -lhexfile -lusb

clean:
	$(RM) *.o $(TARGETS)