1 | # $Id: $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild Makefile for kmk_ash.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2005-2007 knut st. osmundsen <[email protected]>
|
---|
7 | #
|
---|
8 |
|
---|
9 | DEPTH = ../..
|
---|
10 | include $(PATH_KBUILD)/header.kmk
|
---|
11 |
|
---|
12 | #INSTALLS = ash.man
|
---|
13 |
|
---|
14 | PROGRAMS += kmk_ash
|
---|
15 | kmk_ash_TEMPLATE = BIN
|
---|
16 | kmk_ash_DEFS = lint SHELL SMALL
|
---|
17 | kmk_ash_DEFS.linux = BSD
|
---|
18 | kmk_ash_DEFS.solaris = BSD
|
---|
19 | kmk_ash_DEFS.win = \
|
---|
20 | BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS
|
---|
21 | kmk_ash_DEFS.os2 = \
|
---|
22 | HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME \
|
---|
23 | EXEC_HASH_BANG_SCRIPT PC_OS2_LIBPATHS PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS
|
---|
24 | kmk_ash_DEFS.darwin = \
|
---|
25 | HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
|
---|
26 | kmk_ash_DEFS.freebsd = \
|
---|
27 | HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
|
---|
28 | kmk_ash_INCS = $(PATH_TARGET) . # (the last is because of error.h)
|
---|
29 | kmk_ash_CFLAGS.win = -I. ## @todo kBuild bug.
|
---|
30 | kmk_ash_INCS.win = win
|
---|
31 | kmk_ash_SOURCES = \
|
---|
32 | main.c \
|
---|
33 | alias.c \
|
---|
34 | cd.c \
|
---|
35 | error.c \
|
---|
36 | eval.c \
|
---|
37 | exec.c \
|
---|
38 | expand.c \
|
---|
39 | histedit.c \
|
---|
40 | input.c \
|
---|
41 | jobs.c \
|
---|
42 | mail.c \
|
---|
43 | memalloc.c \
|
---|
44 | miscbltin.c \
|
---|
45 | mystring.c \
|
---|
46 | options.c \
|
---|
47 | output.c \
|
---|
48 | parser.c \
|
---|
49 | redir.c \
|
---|
50 | show.c \
|
---|
51 | syntax.c \
|
---|
52 | trap.c \
|
---|
53 | var.c \
|
---|
54 | bltin/echo.c \
|
---|
55 | bltin/kill.c \
|
---|
56 | bltin/test.c \
|
---|
57 | $(PATH_TARGET)/arith.c \
|
---|
58 | $(PATH_TARGET)/arith_lex.c \
|
---|
59 | $(PATH_TARGET)/builtins.c \
|
---|
60 | $(PATH_TARGET)/init.c \
|
---|
61 | $(PATH_TARGET)/nodes.c \
|
---|
62 | \
|
---|
63 | shinstance.c \
|
---|
64 | shthread.c \
|
---|
65 | shfile.c
|
---|
66 | kmk_ash_SOURCES.linux = \
|
---|
67 | sys_signame.c \
|
---|
68 | strlcpy.c \
|
---|
69 | setmode.c
|
---|
70 | kmk_ash_SOURCES.win = \
|
---|
71 | win/mscfakes.c \
|
---|
72 | win/err.c \
|
---|
73 | win/dirent.c \
|
---|
74 | sys_signame.c \
|
---|
75 | strlcpy.c \
|
---|
76 | setmode.c
|
---|
77 | kmk_ash_SOURCES.solaris = \
|
---|
78 | sys_signame.c \
|
---|
79 | strlcpy.c \
|
---|
80 | setmode.c
|
---|
81 |
|
---|
82 | kmk_ash_DEPS = \
|
---|
83 | $(PATH_TARGET)/arith.h \
|
---|
84 | $(PATH_TARGET)/builtins.h \
|
---|
85 | $(PATH_TARGET)/nodes.h \
|
---|
86 | $(PATH_TARGET)/token.h
|
---|
87 | kmk_ash_CLEAN = \
|
---|
88 | $(kmk_ash_DEPS) \
|
---|
89 | $(PATH_TARGET)/arith.c \
|
---|
90 | $(PATH_TARGET)/arith_lex.c \
|
---|
91 | $(PATH_TARGET)/builtins.c \
|
---|
92 | $(PATH_TARGET)/init.c \
|
---|
93 | $(PATH_TARGET)/nodes.c
|
---|
94 |
|
---|
95 | kmk_ash.man_TEMPLATE = usr.bin.man
|
---|
96 | kmk_ash.man_SOURCES = \
|
---|
97 | sh.1=>ash.1
|
---|
98 | #ash.man_SYMLINKS = \
|
---|
99 | # ash.1.gz=>sh.1
|
---|
100 |
|
---|
101 |
|
---|
102 |
|
---|
103 | ifeq ($(filter-out nt win win32 win64,$(BUILD_TARGET)),)
|
---|
104 |
|
---|
105 | #
|
---|
106 | # Use the pregenerated code.
|
---|
107 | #
|
---|
108 | kmk_ash_DEPS :=
|
---|
109 |
|
---|
110 | define def_copy_generated
|
---|
111 | $(PATH_TARGET)/$(src): generated/$(src)
|
---|
112 | $$(RM) -f $$@
|
---|
113 | $$(CP) -f $$^ $$@
|
---|
114 | kmk_ash_DEPS += $(PATH_TARGET)/$(src)
|
---|
115 | endef
|
---|
116 |
|
---|
117 | #$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\
|
---|
118 | #$(eval $(def_copy_generated)))
|
---|
119 |
|
---|
120 | kmk_ash_INCS += generated
|
---|
121 | kmk_ash_DEFS += HAVE_SYS_CDEFS_H
|
---|
122 |
|
---|
123 | include $(PATH_KBUILD)/footer.kmk
|
---|
124 |
|
---|
125 | else
|
---|
126 |
|
---|
127 | include $(PATH_KBUILD)/footer.kmk
|
---|
128 |
|
---|
129 | #
|
---|
130 | # ATTENTION! ATTENTION! ATTENTION!
|
---|
131 | #
|
---|
132 | # Older ash versions has trouble with some of these scripts, great.
|
---|
133 | # Kudos to the NetBSD guys for this clever move. ;)
|
---|
134 | #
|
---|
135 | # So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
|
---|
136 | #
|
---|
137 | BOOTSTRAP_SHELL ?= $(SHELL)
|
---|
138 | YACC ?= yacc
|
---|
139 |
|
---|
140 | $(PATH_TARGET)/arith.h $(PATH_TARGET)/arith.c: arith.y | $(call DIRDEP,$(PATH_TARGET))
|
---|
141 | $(YACC) -ld $^
|
---|
142 | $(MV) -f y.tab.c $(PATH_TARGET)/arith.c
|
---|
143 | $(MV) -f y.tab.h $(PATH_TARGET)/arith.h
|
---|
144 |
|
---|
145 | $(PATH_TARGET)/arith_lex.c: arith_lex.l | $(call DIRDEP,$(PATH_TARGET))
|
---|
146 | flex -8 -o$@ $^ # 8-bit lex scanner for arithmetic
|
---|
147 |
|
---|
148 | $(PATH_TARGET)/builtins.h $(PATH_TARGET)/builtins.c: $(PATH_CURRENT)/mkbuiltins shell.h builtins.def | $(call DIRDEP,$(PATH_TARGET))
|
---|
149 | $(BOOTSTRAP_SHELL) $+ $(dir $@)
|
---|
150 | [ -f $(PATH_TARGET)/builtins.h ]
|
---|
151 |
|
---|
152 | $(PATH_TARGET)/nodes.h $(PATH_TARGET)/nodes.c: $(PATH_CURRENT)/mknodes.sh nodetypes nodes.c.pat | $(call DIRDEP,$(PATH_TARGET))
|
---|
153 | $(BOOTSTRAP_SHELL) $+ $(dir $@)
|
---|
154 | [ -f $(dir $@)/nodes.h ]
|
---|
155 |
|
---|
156 | $(PATH_TARGET)/token.h: $(PATH_CURRENT)/mktokens | $(call DIRDEP,$(PATH_TARGET))
|
---|
157 | $(BOOTSTRAP_SHELL) $+
|
---|
158 | $(MV) token.h $@
|
---|
159 |
|
---|
160 | $(PATH_TARGET)/init.c: $(PATH_CURRENT)/mkinit.sh $(filter-out $(PATH_TARGET)/%,$(kmk_ash_SOURCES)) | $(call DIRDEP,$(PATH_TARGET))
|
---|
161 | $(BOOTSTRAP_SHELL) $+
|
---|
162 | $(MV) init.c $@
|
---|
163 |
|
---|
164 | endif
|
---|