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
|
2019-08-26 08:11:32 +08:00
|
|
|
FILTERS = filter.o mave.o mmedian.o
|
|
|
|
SERVOS = linreg.o ntpshm.o nullf.o pi.o servo.o
|
|
|
|
TRANSP = raw.o transport.o udp.o udp6.o uds.o
|
|
|
|
OBJ = bmc.o clock.o clockadj.o clockcheck.o config.o designated_fsm.o \
|
2020-02-09 23:22:52 +08:00
|
|
|
e2e_tc.o fault.o $(FILTERS) fsm.o hash.o interface.o msg.o phc.o port.o \
|
|
|
|
port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o $(SERVOS) sk.o \
|
|
|
|
stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.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
|
|
|
|
2020-02-09 23:24:19 +08:00
|
|
|
nsm: config.o $(FILTERS) hash.o interface.o msg.o nsm.o phc.o print.o \
|
2019-08-26 08:11:32 +08:00
|
|
|
rtnl.o sk.o $(TRANSP) tlv.o tsproc.o util.o version.o
|
2018-02-27 00:34:50 +08:00
|
|
|
|
2020-02-09 23:24:19 +08:00
|
|
|
pmc: config.o hash.o interface.o msg.o phc.o pmc.o pmc_common.o print.o sk.o \
|
|
|
|
tlv.o $(TRANSP) util.o version.o
|
2015-08-13 00:34:04 +08:00
|
|
|
|
2020-02-09 23:24:19 +08:00
|
|
|
phc2sys: clockadj.o clockcheck.o config.o hash.o interface.o msg.o \
|
2019-08-26 08:11:32 +08:00
|
|
|
phc.o phc2sys.o pmc_common.o print.o $(SERVOS) sk.o stats.o \
|
|
|
|
sysoff.o tlv.o $(TRANSP) 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
|
|
|
|
|
2019-07-08 09:13:39 +08:00
|
|
|
timemaster: phc.o 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
|