VirtualBox

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

Last change on this file since 1198 was 1198, checked in by bird, 17 years ago

moving globals into shinstance...

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