xref: /illumos-gate/usr/src/contrib/ast/src/lib/libcmd/Makefile (revision b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f)
1/*
2 * command library -- commands small enough to be builtins
3 */
4
5:PACKAGE: ast
6
7LICENSE = since=1992,author=gsf+dgk
8
9CCFLAGS = $(CC.SUFFIX.DEBUG:+$(CC.DEBUG)) $(CC.OPTIMIZE) $(CC.DLL)
10
11/* 2009-04-15 ld.so experiment -- may become a default for all plugins */
12CC.DLL.ORIGIN = $(CC.LD.ORIGIN:C,/.*,,)
13LDFLAGS = $(CC.DLL.ORIGIN)
14
15CP = $(STDCP|"cp")
16CHMOD = $(STDCHMOD|"chmod")
17
18HOSTTYPE == "$(CC.HOSTTYPE)"
19
20cmd 1.2 :LIBRARY: RELEASE cmdinit.c \
21	cmd.h rev.h wc.h \
22	basename.c cat.c chgrp.c chmod.c chown.c cksum.c cmp.c \
23	comm.c cp.c cut.c dirname.c date.c expr.c fds.c fmt.c fold.c \
24	getconf.c head.c id.c join.c ln.c logname.c md5sum.c mkdir.c \
25	mkfifo.c mktemp.c mv.c paste.c pathchk.c pids.c rev.c rm.c \
26	rmdir.c stty.c sum.c sync.c tail.c tee.c tty.c uname.c uniq.c \
27	vmstate.c wc.c revlib.c wclib.c sumlib.o \
28	fts_fix.c lib.c \
29	-lfsg -lmd -lutil
30
31sumlib.o : +lsum
32	$(AR) x $(*:O=1) $(<)
33
34$(INCLUDEDIR) :INSTALLPROTO: cmd.h cmdext.h cmdlist.h
35
36"win32*" :NOOPTIMIZE: id.c
37
38src = $(*$(*$(*cmd)):N=*.c:T=F)
39
40cmdext.h : (src) $$(-mam:+$$(src))
41	{
42	cat <<!
43	$("#")pragma prototyped
44	$("/")*
45	$(" ")* -lcmd extern function prototypes
46	$(" ")*/
47
48	$("#")include <shcmd.h>
49
50	!
51	$(SED) \
52		-e '/^b_[a-z_][a-z_0-9]*(/!d' \
53		-e 's/^b_//' \
54		-e 's/(.*//' \
55		-e 's/.*/extern int	b_&(int, char**, Shbltin_t*);/' \
56		$($(~:O=1)) |
57	$(SORT) -u
58	} > 1.$(tmp).h
59	if	$(CMP) $(CMPFLAGS) 1.$(tmp).h $(<)
60	then	$(RM) $(RMFLAGS) 1.$(tmp).h
61	else	$(MV) 1.$(tmp).h $(<)
62	fi
63
64cmdlist.h : (src) $$(-mam:+$$(src))
65	{
66	cat <<!
67	$("#")pragma prototyped
68	$("/")*
69	$(" ")* -lcmd function list -- define your own CMDLIST()
70	$(" ")*/
71
72	!
73	$(SED) \
74		-e '/^b_[a-z_][a-z_0-9]*(/!d' \
75		-e 's/^b_//' \
76		-e 's/(.*//' \
77		-e 's/.*/CMDLIST(&)/' \
78		$($(~):T=F) |
79	$(SORT) -u
80	} > 1.$(tmp).h
81	if	$(CMP) $(CMPFLAGS) 1.$(tmp).h $(<)
82	then	$(RM) $(RMFLAGS) 1.$(tmp).h
83	else	$(MV) 1.$(tmp).h $(<)
84	fi
85
86if CC.HOSTTYPE == "sun4"
87	pathsetlink == symlink	/* ld.so workaround */
88end
89
90ignore dlldefs.h /* prevents bootstrap double build */
91