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)
|
2014-10-03 20:13:52 +08:00
|
|
|
PRG = ptp4l pmc phc2sys hwstamp_ctl phc_ctl timemaster
|
2013-10-23 00:57:15 +08:00
|
|
|
OBJ = bmc.o clock.o clockadj.o clockcheck.o config.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 \
|
2014-06-12 00:07:08 +08:00
|
|
|
pi.o port.o print.o ptp4l.o raw.o servo.o sk.o stats.o tlv.o \
|
2015-03-26 23:32:13 +08:00
|
|
|
transport.o tsproc.o udp.o udp6.o uds.o util.o version.o
|
2011-11-02 01:00:16 +08:00
|
|
|
|
2014-10-03 20:13:52 +08:00
|
|
|
OBJECTS = $(OBJ) hwstamp_ctl.o phc2sys.o phc_ctl.o pmc.o pmc_common.o \
|
|
|
|
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
|
|
|
|
2013-01-31 01:31:50 +08:00
|
|
|
pmc: msg.o pmc.o pmc_common.o print.o raw.o sk.o tlv.o transport.o udp.o \
|
|
|
|
udp6.o uds.o util.o version.o
|
2012-08-05 20:14:44 +08:00
|
|
|
|
2015-06-08 21:55:55 +08:00
|
|
|
phc2sys: clockadj.o clockcheck.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 \
|
2014-03-14 01:34:18 +08:00
|
|
|
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
|
|
|
|
|
2014-10-03 20:13:52 +08:00
|
|
|
timemaster: print.o sk.o timemaster.o util.o version.o
|
|
|
|
|
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)
|
|
|
|
install -p -m 644 -t $(DESTDIR)$(man8dir) $(PRG:%=%.8)
|
2012-11-06 00:13:28 +08:00
|
|
|
|
2011-11-02 01:00:16 +08:00
|
|
|
clean:
|
2012-01-25 02:12:57 +08:00
|
|
|
rm -f $(OBJECTS) $(DEPEND)
|
2011-11-02 01:00:16 +08:00
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -f $(PRG)
|
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
|