2011-11-02 01:00:16 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2011 Richard Cochran <richardcochran@gmail.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
2013-09-29 21:24:28 +08:00
|
|
|
KBUILD_OUTPUT =
|
2012-09-05 23:00:30 +08:00
|
|
|
|
2011-11-02 01:00:16 +08:00
|
|
|
DEBUG =
|
2012-07-24 18:30:06 +08:00
|
|
|
CC = $(CROSS_COMPILE)gcc
|
2012-12-09 16:42:47 +08:00
|
|
|
VER = -DVER=$(version)
|
2013-09-29 21:24:28 +08:00
|
|
|
CFLAGS = -Wall $(VER) $(incdefs) $(DEBUG) $(EXTRA_CFLAGS)
|
2012-07-24 18:30:06 +08:00
|
|
|
LDLIBS = -lm -lrt $(EXTRA_LDFLAGS)
|
2018-02-27 00:34:50 +08:00
|
|
|
PRG = ptp4l hwstamp_ctl nsm phc2sys phc_ctl pmc timemaster
|
2018-03-20 23:07:41 +08:00
|
|
|
OBJ = bmc.o clock.o clockadj.o clockcheck.o config.o e2e_tc.o fault.o \
|
2015-08-09 01:16:28 +08:00
|
|
|
filter.o fsm.o hash.o linreg.o mave.o mmedian.o msg.o ntpshm.o nullf.o phc.o \
|
2018-04-05 01:10:21 +08:00
|
|
|
pi.o port.o port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o raw.o rtnl.o \
|
|
|
|
servo.o sk.o stats.o tc.o telecom.o tlv.o transport.o tsproc.o udp.o udp6.o \
|
2018-03-31 23:29:05 +08:00
|
|
|
uds.o unicast_client.o unicast_fsm.o unicast_service.o util.o version.o
|
2011-11-02 01:00:16 +08:00
|
|
|
|
2018-02-27 00:34:50 +08:00
|
|
|
OBJECTS = $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o phc_ctl.o pmc.o pmc_common.o \
|
2014-10-03 20:13:52 +08:00
|
|
|
sysoff.o timemaster.o
|
2012-01-25 02:12:57 +08:00
|
|
|
SRC = $(OBJECTS:.o=.c)
|
|
|
|
DEPEND = $(OBJECTS:.o=.d)
|
2011-11-02 01:00:16 +08:00
|
|
|
srcdir := $(dir $(lastword $(MAKEFILE_LIST)))
|
2013-09-29 21:24:28 +08:00
|
|
|
incdefs := $(shell $(srcdir)/incdefs.sh)
|
2012-12-09 16:42:47 +08:00
|
|
|
version := $(shell $(srcdir)/version.sh $(srcdir))
|
2011-11-02 01:00:16 +08:00
|
|
|
VPATH = $(srcdir)
|
|
|
|
|
2012-11-06 00:13:28 +08:00
|
|
|
prefix = /usr/local
|
|
|
|
sbindir = $(prefix)/sbin
|
|
|
|
mandir = $(prefix)/man
|
|
|
|
man8dir = $(mandir)/man8
|
|
|
|
|
2012-02-20 01:23:50 +08:00
|
|
|
all: $(PRG)
|
2011-11-02 01:00:16 +08:00
|
|
|
|
2011-12-13 16:09:08 +08:00
|
|
|
ptp4l: $(OBJ)
|
2011-11-02 01:00:16 +08:00
|
|
|
|
2018-02-27 00:34:50 +08:00
|
|
|
nsm: config.o filter.o hash.o mave.o mmedian.o msg.o nsm.o print.o raw.o \
|
|
|
|
rtnl.o sk.o transport.o tlv.o tsproc.o udp.o udp6.o uds.o util.o version.o
|
|
|
|
|
2015-08-13 00:34:04 +08:00
|
|
|
pmc: config.o hash.o msg.o pmc.o pmc_common.o print.o raw.o sk.o tlv.o \
|
2014-03-14 01:34:18 +08:00
|
|
|
transport.o udp.o udp6.o uds.o util.o version.o
|
2015-08-13 00:34:04 +08:00
|
|
|
|
|
|
|
phc2sys: clockadj.o clockcheck.o config.o hash.o linreg.o msg.o ntpshm.o \
|
|
|
|
nullf.o phc.o phc2sys.o pi.o pmc_common.o print.o raw.o servo.o sk.o stats.o \
|
|
|
|
sysoff.o tlv.o transport.o udp.o udp6.o uds.o util.o version.o
|
2012-01-25 02:12:57 +08:00
|
|
|
|
2012-12-10 17:28:28 +08:00
|
|
|
hwstamp_ctl: hwstamp_ctl.o version.o
|
2012-01-25 02:22:13 +08:00
|
|
|
|
2014-07-19 04:46:02 +08:00
|
|
|
phc_ctl: phc_ctl.o phc.o sk.o util.o clockadj.o sysoff.o print.o version.o
|
|
|
|
|
2018-04-13 23:11:57 +08:00
|
|
|
timemaster: print.o rtnl.o sk.o timemaster.o util.o version.o
|
2014-10-03 20:13:52 +08:00
|
|
|
|
2012-12-09 18:26:34 +08:00
|
|
|
version.o: .version version.sh $(filter-out version.d,$(DEPEND))
|
|
|
|
|
|
|
|
.version: force
|
|
|
|
@echo $(version) > .version.new; \
|
|
|
|
cmp -s .version .version.new || cp .version.new .version; \
|
|
|
|
rm -f .version.new;
|
|
|
|
|
|
|
|
force:
|
|
|
|
|
2012-11-06 00:13:28 +08:00
|
|
|
install: $(PRG)
|
2015-06-08 15:36:12 +08:00
|
|
|
install -p -m 755 -d $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
|
|
|
|
install $(PRG) $(DESTDIR)$(sbindir)
|
2018-04-06 03:41:25 +08:00
|
|
|
for x in $(PRG:%=%.8); do \
|
|
|
|
[ -f $$x ] && install -p -m 644 -t $(DESTDIR)$(man8dir) $$x ; \
|
|
|
|
done
|
2012-11-06 00:13:28 +08:00
|
|
|
|
2011-11-02 01:00:16 +08:00
|
|
|
clean:
|
2016-12-07 02:48:39 +08:00
|
|
|
rm -f $(OBJECTS) $(DEPEND) $(PRG)
|
2011-11-02 01:00:16 +08:00
|
|
|
|
|
|
|
distclean: clean
|
2012-12-09 18:26:34 +08:00
|
|
|
rm -f .version
|
2011-11-02 01:00:16 +08:00
|
|
|
|
|
|
|
# Implicit rule to generate a C source file's dependencies.
|
|
|
|
%.d: %.c
|
|
|
|
@echo DEPEND $<; \
|
|
|
|
rm -f $@; \
|
|
|
|
$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
|
|
|
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
|
|
rm -f $@.$$$$
|
|
|
|
|
2011-12-13 16:04:08 +08:00
|
|
|
ifneq ($(MAKECMDGOALS), clean)
|
|
|
|
ifneq ($(MAKECMDGOALS), distclean)
|
2011-11-02 01:00:16 +08:00
|
|
|
-include $(DEPEND)
|
2011-12-13 16:04:08 +08:00
|
|
|
endif
|
|
|
|
endif
|
2012-12-09 18:26:34 +08:00
|
|
|
|
|
|
|
.PHONY: all force clean distclean
|