Makefile 2.72 KB
Newer Older
1 2 3 4

# We are now Kconfig-based
-include ../../.config

5
TOOLS = rtu_stat wr_mon wr_phytool wrs_pps_control spll_dbg_proxy load-lm32 load-virtex com
6
TOOLS += mapper wmapper
7
TOOLS += wrs_version wr_date lm32-vuart wrs_pstats wrs_leapsec
8
TOOLS += wrs_vlans wrs_dump_shmem
9
TOOLS += sdb-read
10
TOOLS += nbtee
11
TOOLS += wrs_auxclk
12
TOOLS += wrs_checkcfg
13
TOOLS += wrs_status_led
14
TOOLS += mkpasswd
15
TOOLS += wrs_sfp_dump
16
TOOLS += wrs_throttling
17
TOOLS += utc_leap_test
18
PPSI_CONFIG = ../ppsi/include/generated/autoconf.h
19

20
WR_INSTALL_ROOT ?= /usr/lib/white-rabbit
21 22 23
SCP             ?= scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
SCP_DEV         ?= root@wrsdev
SCP_TARGET      ?= /wr
24

25 26 27 28 29 30 31 32 33 34 35 36
# # Standard stanza for cross-compilation (courtesy of the linux makefile)

AS              = $(CROSS_COMPILE)as
LD              = $(CROSS_COMPILE)ld
CC              = $(CROSS_COMPILE)gcc
CPP             = $(CC) -E
AR              = $(CROSS_COMPILE)ar
NM              = $(CROSS_COMPILE)nm
STRIP           = $(CROSS_COMPILE)strip
OBJCOPY         = $(CROSS_COMPILE)objcopy
OBJDUMP         = $(CROSS_COMPILE)objdump

37
# LOTs of includes
38 39 40 41
export CFLAGS_OPTIMIZATION:= ${shell echo $(CONFIG_OPTIMIZATION)}

CFLAGS += $(CFLAGS_OPTIMIZATION)
CFLAGS += -Wall \
42
		-Wstrict-prototypes \
43 44 45
		-I$(LINUX)/arch/arm/mach-at91/include \
		-I../wrsw_rtud \
		-I../mini-rpc \
46
		-I../libsdb \
47
		-I../include \
48
		-I../libwr/include \
49
		-include $(PPSI_CONFIG) \
50
		-I../ppsi/include \
51 52
		-I../ppsi/arch-wrs/include \
		-I.
53

54
# for wrs_version alone (but others may use this)
55
GIT_VER = $(shell git describe --always --dirty | sed  's;^wr-switch-sw-;;')
56 57 58
GIT_USR = $(shell  git config --get-all user.name)
CFLAGS += -D__GIT_USR__="\"${GIT_USR}\"" -D__GIT_VER__="\"${GIT_VER}\""

59
LDFLAGS = -L../mini-rpc \
60
		-L../libwr \
61
		-L../libsdb \
62
		-lwr -lminipc -lsdbfs -lm -ldl
63

64 65 66 67 68 69 70 71 72 73
all:

all: 	check $(TOOLS)

check:
	@if [ ! -f $(PPSI_CONFIG) ]; then echo ""; echo ""; \
		echo "##### Please configure ppsi before building tools"; \
		echo ""; echo ""; \
		exit 1; \
	fi
74

75 76
%: %.c
	$(CC) $(CFLAGS) $*.c $(LDFLAGS) -o $*
77

78 79 80
%: %.o
	$(CC) $*.o $(LDFLAGS) -o $*

81
VPATH+=../ppsi/tools
82
wrs_dump_shmem: wrs_dump_shmem.o wrs_dump_shmem_ppsi.o time_lib.o
83 84
	${CC} -o $@ $^ $(LDFLAGS)

85
wr_mon: wr_mon.o term.o  time_lib.o
86
	${CC} -o $@ $^ $(LDFLAGS)
87

88 89 90
wr_date: wr_date.o time_lib.o
	${CC} -o $@ $^ $(LDFLAGS)

91 92 93 94
wrs_leapsec: wrs_leapsec.o time_lib.o
	${CC} -o $@ $^ $(LDFLAGS)


Jean-Claude BAU's avatar
Jean-Claude BAU committed
95 96 97
fix_tai_offset: fix_tai_offset.o time_lib.o
	${CC} -o $@ $^ $(LDFLAGS)

98 99 100
wr_management: wr_management.o term.o
	${CC} -o $@ $^ $(LDFLAGS)

101 102 103
clean:
	rm -f $(TOOLS) *.o *~

104
install: all
105 106
	install -d $(WR_INSTALL_ROOT)/bin
	install $(TOOLS) $(WR_INSTALL_ROOT)/bin
107

108 109 110
scp: all
	$(SCP) $(TOOLS) $(SCP_DEV):$(SCP_TARGET)/bin/

111 112
mkpasswd: mkpasswd.o utils.o
	${CC} -o $@ $^ $(LDFLAGS) -lcrypt