VirtualBox

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

Last change on this file since 2392 was 2390, checked in by bird, 15 years ago

kash: windows build fix.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
1# $Id: Makefile.kmk 2390 2010-02-14 22:52: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_NAME.win = kmk_ash
35kash_ASTOOL = YASM
36kash_DEFS = lint SHELL SMALL
37kash_DEFS += SH_FORKED_MODE
38kash_DEFS.debug = DEBUG=2
39kash_DEFS.linux = BSD
40kash_DEFS.solaris = BSD
41## @todo bring over PC_SLASHES?
42kash_DEFS.win = \
43 BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS YY_NO_UNISTD_H SH_DEAL_WITH_CRLF
44kash_DEFS.os2 = \
45 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME \
46 EXEC_HASH_BANG_SCRIPT PC_OS2_LIBPATHS PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS
47kash_DEFS.darwin = \
48 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
49kash_DEFS.dragonfly = \
50 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
51kash_DEFS.freebsd = \
52 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
53kash_INCS = $(kash_0_OUTDIR) . # (the last is because of error.h)
54kash_ASFLAGS.win = -g cv8
55kash_ASFLAGS.win.x86 = -f win32
56kash_ASFLAGS.win.amd64 = -f win64
57if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win"
58kash_CFLAGS += -std=gnu99
59endif
60kash_CFLAGS.win.amd64 = -GS-
61kash_SOURCES = \
62 main.c \
63 alias.c \
64 cd.c \
65 error.c \
66 eval.c \
67 exec.c \
68 expand.c \
69 histedit.c \
70 input.c \
71 jobs.c \
72 mail.c \
73 memalloc.c \
74 mystring.c \
75 options.c \
76 output.c \
77 parser.c \
78 redir.c \
79 show.c \
80 syntax.c \
81 trap.c \
82 var.c \
83 miscbltin.c \
84 bltin/echo.c \
85 bltin/kill.c \
86 bltin/test.c \
87 \
88 $(kash_0_OUTDIR)/builtins.c \
89 $(kash_0_OUTDIR)/init.c \
90 $(kash_0_OUTDIR)/nodes.c \
91 \
92 setmode.c \
93 shinstance.c \
94 shheap.c \
95 shthread.c \
96 shfile.c
97kash_SOURCES.linux = \
98 sys_signame.c \
99 strlcpy.c
100kash_SOURCES.win = \
101 sys_signame.c \
102 strlcpy.c \
103 shfork-win.c \
104 shforkA-win.asm
105kash_SOURCES.solaris = \
106 sys_signame.c \
107 strlcpy.c
108
109kash_INTERMEDIATES = \
110 $(kash_0_OUTDIR)/builtins.h \
111 $(kash_0_OUTDIR)/nodes.h \
112 $(kash_0_OUTDIR)/token.h
113kash_CLEAN = \
114 $(kash_INTERMEDIATES) \
115 $(kash_0_OUTDIR)/builtins.c \
116 $(kash_0_OUTDIR)/init.c \
117 $(kash_0_OUTDIR)/nodes.c
118
119##
120## The manual page.
121##
122#INSTALLS += kash.man
123#kash.man_TEMPLATE = usr.bin.man
124#kash.man_SOURCES = sh.1=>kash.1
125
126
127if1of ($(KBUILD_TARGET), win)
128
129#
130# Use the pregenerated code.
131#
132kash_SOURCES += \
133 $(kash_0_OUTDIR)/arith.c \
134 $(kash_0_OUTDIR)/arith_lex.c
135kash_INTERMEDIATES += \
136 $(kash_0_OUTDIR)/arith.h
137
138define def_copy_generated
139$$$$(kash_0_OUTDIR)/$(src): $(PATH_SUB_CURRENT)/generated/$(src)
140 $$(RM) -f $$@
141 $$(CP) -f $$^ $$@
142endef
143
144$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\
145$(eval $(def_copy_generated)))
146
147else
148
149#
150# Generate the code on the fly.
151#
152
153USES += lex yacc
154kash_USES = lex yacc
155kash_LEXTOOL = FLEX
156kash_LEXFLAGS = -8
157#kash_YACCTOOL = BISON
158kash_YACCTOOL = YACC
159kash_YACCFLAGS = -ld
160kash_SOURCES += \
161 arith.y \
162 arith_lex.l
163
164#
165# ATTENTION! ATTENTION! ATTENTION!
166#
167# Older ash versions has trouble with some of these scripts, great.
168# Kudos to the NetBSD guys for this clever move. ;)
169#
170# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
171#
172BOOTSTRAP_SHELL ?= $(SHELL)
173
174$$(kash_0_OUTDIR)/builtins.h + $$(kash_0_OUTDIR)/builtins.c: \
175 $$(kash_DEFPATH)/mkbuiltins \
176 $$(kash_DEFPATH)/shell.h \
177 $$(kash_DEFPATH)/builtins.def \
178 | $$(dir $$@)
179 $(BOOTSTRAP_SHELL) $+ $(dir $@)
180 [ -f $(kash_0_OUTDIR)/builtins.h ]
181
182$$(kash_0_OUTDIR)/nodes.h + $$(kash_0_OUTDIR)/nodes.c: \
183 $$(kash_DEFPATH)/mknodes.sh \
184 $$(kash_DEFPATH)/nodetypes \
185 $$(kash_DEFPATH)/nodes.c.pat \
186 | $$(dir $$@)
187 $(BOOTSTRAP_SHELL) $+ $(dir $@)
188 [ -f $(dir $@)/nodes.h ]
189
190$$(kash_0_OUTDIR)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@)
191 $(BOOTSTRAP_SHELL) $+
192 $(MV) token.h $@
193
194$$(kash_0_OUTDIR)/init.c: \
195 $$(kash_DEFPATH)/mkinit.sh \
196 $$(abspathex $$(filter-out $$(kash_0_OUTDIR)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \
197 | $$(dir $$@)
198 $(BOOTSTRAP_SHELL) $+
199 $(MV) init.c $@
200
201endif
202
203#
204# For debugging file handle inheritance on Windows.
205#
206if "$(KBUILD_TARGET)" == win && 0
207PROGRAMS += tstDump
208tstDump_TEMPLATE = BIN
209tstDump_SOURCES = tstDump.c
210endif
211
212# Include the sub-makefile.
213include $(PATH_SUB_CURRENT)/tests/Makefile.kmk
214
215include $(FILE_KBUILD_SUB_FOOTER)
216
217
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