VirtualBox

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

Last change on this file since 2498 was 2498, checked in by bird, 13 years ago

kash: OS/2 build fixes.

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