VirtualBox

source: kBuild/trunk/src/kash/Makefile.kmk@ 2307

Last change on this file since 2307 was 2304, checked in by bird, 16 years ago

kash: CRLF hacking, tests run cleanly on windows now!

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1# $Id: Makefile.kmk 2304 2009-03-01 07:48:14Z bird $
2## @file
3# Sub-makefile for kash.
4#
5
6#
7# Copyright (c) 2005-2009 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 3 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, see <http://www.gnu.org/licenses/>
23#
24#
25
26SUB_DEPTH = ../..
27include $(KBUILD_PATH)/subheader.kmk
28
29#
30# The program.
31#
32PROGRAMS += kash
33kash_TEMPLATE = BIN
34kash_ASTOOL = YASM
35kash_DEFS = lint SHELL SMALL
36kash_DEFS += SH_FORKED_MODE
37kash_DEFS.debug = DEBUG=2
38kash_DEFS.linux = BSD
39kash_DEFS.solaris = BSD
40## @todo bring over PC_SLASHES?
41kash_DEFS.win = \
42 BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS YY_NO_UNISTD_H SH_DEAL_WITH_CRLF
43kash_DEFS.os2 = \
44 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME \
45 EXEC_HASH_BANG_SCRIPT PC_OS2_LIBPATHS PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS
46kash_DEFS.darwin = \
47 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
48kash_DEFS.dragonfly = \
49 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
50kash_DEFS.freebsd = \
51 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
52kash_INCS = $(PATH_kash) . # (the last is because of error.h)
53kash_ASFLAGS.win = -g cv8
54kash_ASFLAGS.win.x86 = -f win32
55kash_ASFLAGS.win.amd64 = -f win64
56if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win"
57kash_CFLAGS += -std=gnu99
58endif
59kash_CFLAGS.win = -GS-
60kash_SOURCES = \
61 main.c \
62 alias.c \
63 cd.c \
64 error.c \
65 eval.c \
66 exec.c \
67 expand.c \
68 histedit.c \
69 input.c \
70 jobs.c \
71 mail.c \
72 memalloc.c \
73 mystring.c \
74 options.c \
75 output.c \
76 parser.c \
77 redir.c \
78 show.c \
79 syntax.c \
80 trap.c \
81 var.c \
82 miscbltin.c \
83 bltin/echo.c \
84 bltin/kill.c \
85 bltin/test.c \
86 \
87 $(PATH_kash)/arith.c \
88 $(PATH_kash)/arith_lex.c \
89 $(PATH_kash)/builtins.c \
90 $(PATH_kash)/init.c \
91 $(PATH_kash)/nodes.c \
92 \
93 setmode.c \
94 shinstance.c \
95 shheap.c \
96 shthread.c \
97 shfile.c
98kash_SOURCES.linux = \
99 sys_signame.c \
100 strlcpy.c
101kash_SOURCES.win = \
102 sys_signame.c \
103 strlcpy.c \
104 shfork-win.c \
105 shforkA-win.asm
106kash_SOURCES.solaris = \
107 sys_signame.c \
108 strlcpy.c
109
110kash_INTERMEDIATES = \
111 $(PATH_kash)/arith.h \
112 $(PATH_kash)/builtins.h \
113 $(PATH_kash)/nodes.h \
114 $(PATH_kash)/token.h
115kash_CLEAN = \
116 $(kash_INTERMEDIATES) \
117 $(PATH_kash)/arith.c \
118 $(PATH_kash)/arith_lex.c \
119 $(PATH_kash)/builtins.c \
120 $(PATH_kash)/init.c \
121 $(PATH_kash)/nodes.c
122
123##
124## The manual page.
125##
126#INSTALLS += kash.man
127#kash.man_TEMPLATE = usr.bin.man
128#kash.man_SOURCES = sh.1=>kash.1
129
130
131if1of ($(KBUILD_TARGET), win)
132
133#
134# Use the pregenerated code.
135#
136kash_INTERMEDIATES :=
137kash_INCS += generated
138kash_SOURCES := $(patsubst $(PATH_kash)/%,generated/%,$(kash_SOURCES))
139
140else
141
142#
143# ATTENTION! ATTENTION! ATTENTION!
144#
145# Older ash versions has trouble with some of these scripts, great.
146# Kudos to the NetBSD guys for this clever move. ;)
147#
148# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
149#
150BOOTSTRAP_SHELL ?= $(SHELL)
151ifndef YACC
152 YACC := $(firstword $(which byacc) $(which yacc) yacc)
153endif
154
155$$(PATH_kash)/arith.h + $$(PATH_kash)/arith.c: arith.y | $$(dir $$@)
156 $(YACC) -ld $^
157 $(MV) -f y.tab.c $(PATH_kash)/arith.c
158 $(MV) -f y.tab.h $(PATH_kash)/arith.h
159
160$$(PATH_kash)/arith_lex.c: $$(kash_DEFPATH)/arith_lex.l | $$(dir $$@)
161 flex -8 -o$@ $^ # 8-bit lex scanner for arithmetic
162
163$$(PATH_kash)/builtins.h + $$(PATH_kash)/builtins.c: \
164 $$(kash_DEFPATH)/mkbuiltins \
165 $$(kash_DEFPATH)/shell.h \
166 $$(kash_DEFPATH)/builtins.def \
167 | $$(dir $$@)
168 $(BOOTSTRAP_SHELL) $+ $(dir $@)
169 [ -f $(PATH_kash)/builtins.h ]
170
171$$(PATH_kash)/nodes.h + $$(PATH_kash)/nodes.c: \
172 $$(kash_DEFPATH)/mknodes.sh \
173 $$(kash_DEFPATH)/nodetypes \
174 $$(kash_DEFPATH)/nodes.c.pat \
175 | $$(dir $$@)
176 $(BOOTSTRAP_SHELL) $+ $(dir $@)
177 [ -f $(dir $@)/nodes.h ]
178
179$$(PATH_kash)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@)
180 $(BOOTSTRAP_SHELL) $+
181 $(MV) token.h $@
182
183$$(PATH_kash)/init.c: \
184 $$(kash_DEFPATH)/mkinit.sh \
185 $$(abspathex $$(filter-out $$(PATH_kash)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \
186 | $$(dir $$@)
187 $(BOOTSTRAP_SHELL) $+
188 $(MV) init.c $@
189
190endif
191
192# Include the sub-makefile.
193include $(PATH_SUB_CURRENT)/tests/Makefile.kmk
194
195include $(FILE_KBUILD_SUB_FOOTER)
196
197
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette