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