1 | # $Id: Makefile.kmk 1509 2008-04-09 00:40:05Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild Makefile for kash.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2005-2008 knut st. osmundsen <[email protected]>
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 2 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild; if not, write to the Free Software
|
---|
23 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
24 | #
|
---|
25 | #
|
---|
26 |
|
---|
27 | DEPTH = ../..
|
---|
28 | include $(PATH_KBUILD)/header.kmk
|
---|
29 |
|
---|
30 | #
|
---|
31 | # The program.
|
---|
32 | #
|
---|
33 | PROGRAMS += kash
|
---|
34 | kash_TEMPLATE = BIN
|
---|
35 | kash_DEFS = lint SHELL SMALL
|
---|
36 | kash_DEFS += SH_STUB_MODE # for the time being.
|
---|
37 | kash_DEFS.debug = DEBUG
|
---|
38 | kash_DEFS.linux = BSD
|
---|
39 | kash_DEFS.solaris = BSD
|
---|
40 | kash_DEFS.win = \
|
---|
41 | BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS YY_NO_UNISTD_H
|
---|
42 | kash_DEFS.os2 = \
|
---|
43 | HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME \
|
---|
44 | EXEC_HASH_BANG_SCRIPT PC_OS2_LIBPATHS PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS
|
---|
45 | kash_DEFS.darwin = \
|
---|
46 | HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
|
---|
47 | kash_DEFS.freebsd = \
|
---|
48 | HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
|
---|
49 | kash_INCS = $(PATH_TARGET) . # (the last is because of error.h)
|
---|
50 | kash_SOURCES = \
|
---|
51 | main.c \
|
---|
52 | alias.c \
|
---|
53 | cd.c \
|
---|
54 | error.c \
|
---|
55 | eval.c \
|
---|
56 | exec.c \
|
---|
57 | expand.c \
|
---|
58 | histedit.c \
|
---|
59 | input.c \
|
---|
60 | jobs.c \
|
---|
61 | mail.c \
|
---|
62 | memalloc.c \
|
---|
63 | mystring.c \
|
---|
64 | options.c \
|
---|
65 | output.c \
|
---|
66 | parser.c \
|
---|
67 | redir.c \
|
---|
68 | show.c \
|
---|
69 | syntax.c \
|
---|
70 | trap.c \
|
---|
71 | var.c \
|
---|
72 | miscbltin.c \
|
---|
73 | bltin/echo.c \
|
---|
74 | bltin/kill.c \
|
---|
75 | bltin/test.c \
|
---|
76 | \
|
---|
77 | $(PATH_TARGET)/arith.c \
|
---|
78 | $(PATH_TARGET)/arith_lex.c \
|
---|
79 | $(PATH_TARGET)/builtins.c \
|
---|
80 | $(PATH_TARGET)/init.c \
|
---|
81 | $(PATH_TARGET)/nodes.c \
|
---|
82 | \
|
---|
83 | setmode.c \
|
---|
84 | shinstance.c \
|
---|
85 | shthread.c \
|
---|
86 | shfile.c
|
---|
87 | kash_SOURCES.linux = \
|
---|
88 | sys_signame.c \
|
---|
89 | strlcpy.c
|
---|
90 | kash_SOURCES.win = \
|
---|
91 | sys_signame.c \
|
---|
92 | strlcpy.c
|
---|
93 | kash_SOURCES.solaris = \
|
---|
94 | sys_signame.c \
|
---|
95 | strlcpy.c
|
---|
96 |
|
---|
97 | kash_ORDERDEPS = \
|
---|
98 | $(PATH_TARGET)/arith.h \
|
---|
99 | $(PATH_TARGET)/builtins.h \
|
---|
100 | $(PATH_TARGET)/nodes.h \
|
---|
101 | $(PATH_TARGET)/token.h
|
---|
102 | kash_CLEAN = \
|
---|
103 | $(kash_ORDERDEPS) \
|
---|
104 | $(PATH_TARGET)/arith.c \
|
---|
105 | $(PATH_TARGET)/arith_lex.c \
|
---|
106 | $(PATH_TARGET)/builtins.c \
|
---|
107 | $(PATH_TARGET)/init.c \
|
---|
108 | $(PATH_TARGET)/nodes.c
|
---|
109 |
|
---|
110 | ##
|
---|
111 | ## The manual page.
|
---|
112 | ##
|
---|
113 | #INSTALLS += kash.man
|
---|
114 | #kash.man_TEMPLATE = usr.bin.man
|
---|
115 | #kash.man_SOURCES = sh.1=>kash.1
|
---|
116 |
|
---|
117 |
|
---|
118 | ifeq ($(filter-out win,$(KBUILD_TARGET)),)
|
---|
119 |
|
---|
120 | #
|
---|
121 | # Use the pregenerated code.
|
---|
122 | #
|
---|
123 | kash_ORDERDEPS :=
|
---|
124 | kash_INCS += generated
|
---|
125 | kash_SOURCES := $(patsubst $(PATH_TARGET)/%,generated/%,$(kash_SOURCES))
|
---|
126 |
|
---|
127 | include $(FILE_KBUILD_FOOTER)
|
---|
128 |
|
---|
129 | else
|
---|
130 |
|
---|
131 | include $(FILE_KBUILD_FOOTER)
|
---|
132 |
|
---|
133 | #
|
---|
134 | # ATTENTION! ATTENTION! ATTENTION!
|
---|
135 | #
|
---|
136 | # Older ash versions has trouble with some of these scripts, great.
|
---|
137 | # Kudos to the NetBSD guys for this clever move. ;)
|
---|
138 | #
|
---|
139 | # So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
|
---|
140 | #
|
---|
141 | BOOTSTRAP_SHELL ?= $(SHELL)
|
---|
142 | YACC ?= yacc
|
---|
143 |
|
---|
144 | $(PATH_TARGET)/arith.h $(PATH_TARGET)/arith.c: arith.y | $(call DIRDEP,$(PATH_TARGET))
|
---|
145 | $(YACC) -ld $^
|
---|
146 | $(MV) -f y.tab.c $(PATH_TARGET)/arith.c
|
---|
147 | $(MV) -f y.tab.h $(PATH_TARGET)/arith.h
|
---|
148 |
|
---|
149 | $(PATH_TARGET)/arith_lex.c: arith_lex.l | $(call DIRDEP,$(PATH_TARGET))
|
---|
150 | flex -8 -o$@ $^ # 8-bit lex scanner for arithmetic
|
---|
151 |
|
---|
152 | $(PATH_TARGET)/builtins.h $(PATH_TARGET)/builtins.c: $(PATH_CURRENT)/mkbuiltins shell.h builtins.def | $(call DIRDEP,$(PATH_TARGET))
|
---|
153 | $(BOOTSTRAP_SHELL) $+ $(dir $@)
|
---|
154 | [ -f $(PATH_TARGET)/builtins.h ]
|
---|
155 |
|
---|
156 | $(PATH_TARGET)/nodes.h $(PATH_TARGET)/nodes.c: $(PATH_CURRENT)/mknodes.sh nodetypes nodes.c.pat | $(call DIRDEP,$(PATH_TARGET))
|
---|
157 | $(BOOTSTRAP_SHELL) $+ $(dir $@)
|
---|
158 | [ -f $(dir $@)/nodes.h ]
|
---|
159 |
|
---|
160 | $(PATH_TARGET)/token.h: $(PATH_CURRENT)/mktokens | $(call DIRDEP,$(PATH_TARGET))
|
---|
161 | $(BOOTSTRAP_SHELL) $+
|
---|
162 | $(MV) token.h $@
|
---|
163 |
|
---|
164 | $(PATH_TARGET)/init.c: $(PATH_CURRENT)/mkinit.sh $(filter-out $(PATH_TARGET)/%,$(kash_SOURCES)) | $(call DIRDEP,$(PATH_TARGET))
|
---|
165 | $(BOOTSTRAP_SHELL) $+
|
---|
166 | $(MV) init.c $@
|
---|
167 |
|
---|
168 | endif
|
---|