aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/xntpd/parse/Makefile.kernel
blob: 4cd0acede737106bb6c6c2a4617011b7ab1a99a3 (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#
# very simple makefile (SunOS!)
#
# Possible defines:
# DEBUG_PARSE:	include debug code (STREAMS mechanism and parsing)
# DEBUG_CD:	include signal propagation to sun4c LED (sun4c only)
#
# Possible defines (parsestreams variants only):
# KERNEL:	must define
# VDDRV:	loadable driver support - recommended
# KARCH:	must define at make call for correct kernel module
#               (currently only needed for parsestreams variants)
#
KARCH=
DEFS=-DSTREAM -DKERNEL -DVDDRV -D$(KARCH)
MICROTIME=../ppsclock/sys/$(KARCH)/microtime.s

all:
	@if [ -f /kernel/unix ]; then \
	  $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" KARCH="`(arch -k) 2>/dev/null || uname -a | awk '{ print $5 }'`" -f Makefile.kernel parse; \
	 else \
	  $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" KARCH="`(arch -k) 2>/dev/null || uname -a | awk '{ print $5 }'`" -f Makefile.kernel parsestreams.o; \
	 fi

parse: parsesolaris.c libparse_kernel.a ../lib/libntp.a
	@echo "--- WARNING: SunOS5 support is fresh and hardly tested"
	@echo "---          This code could lead to kernel panics more"
	@echo "---          easily than other streams modules"
	$(CC) -c -I../include -D_KERNEL parsesolaris.c
	ld -r -o parse parsesolaris.o libparse_kernel.a ../lib/libntp.a
	@echo "--- Install 'parse' in /kernel/strmod for automatic loading"

mparsestreams.o: mparsestreams.$(KARCH).o
	@echo "--- You may load mparsestreams.$(KARCH).o via 'modload mparsestreams.$(KARCH).o' into the kernel"

mparsestreams.$(KARCH).o: parsestreams.c microtime.o ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h
	cc -c -DMICROTIME $(DEFS) -I../include parsestreams.c
	ld -r -o $@ parsestreams.o ../lib/libntp.a libparse_kernel.a \
		    microtime.o
	rm -f parsestreams.o

parsestreams.o: parsestreams.$(KARCH).o
	@echo "--- You may load parsestreams.$(KARCH).o via 'modload parsestreams.o' (put in e.g. /sys/<karch>/OBJ) into the kernel"

parsestreams.$(KARCH).o: parsestreams.c ../lib/libntp.a libparse_kernel.a ../include/parse.h ../include/sys/parsestreams.h
	cc -c $(DEFS) -I../include parsestreams.c
	ld -r -o $@ parsestreams.o ../lib/libntp.a libparse_kernel.a
	rm -f parsestreams.o

microtime.o: $(MICROTIME) assym.s
	cc -E -I. $(MICROTIME) | sed -e '/\.global _uniqtime/d' > $@.i
	as -o $@ $@.i
	rm -f $@.i assym.s

assym.s: genassym
	./genassym > $@

genassym: ../ppsclock/sys/genassym/genassym.c
	cc -o $@ $?

libparse_kernel.a:
	$(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)" libparse_kernel.a

../lib/libntp.a:
	cd ../lib && $(MAKE) $(MFLAGS) MFLAGS="$(MFLAGS)"

lint: parsestreams.c ../include/parse.h ../include/sys/parsestreams.h ../lib/llib-llibntp.ln
	lint -u -I../include $(DEFS) parsestreams.c ../lib/llib-llibntp.ln

../lib/llib-llibntp.ln:
	cd ../lib && make lintlib

clean:
	rm -f *.o genassym assym.s parsestreams

distclean: clean