source: mainline/uspace/app/ash/Makefile@ 5d67baa

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 5d67baa was f52e6fea, checked in by Josef Cejka <malyzelenyhnus@…>, 18 years ago

Ash - add recursion to Makefile to create build tools in subdirectory.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1#
2# Copyright (c) 2005 Martin Decky
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
9# - Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# - Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# - The name of the author may not be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29include ../../../version
30include ../../Makefile.config
31
32## Setup toolchain
33#
34
35LIBC_PREFIX = ../../lib/libc
36SOFTINT_PREFIX = ../../lib/softint
37include $(LIBC_PREFIX)/Makefile.toolchain
38
39CFLAGS += \
40 -DSHELL \
41 -I. \
42 -DNO_HISTORY \
43 -DBSD=1 \
44 -DSMALL \
45 -D_GNU_SOURCE \
46 -DGLOB_BROKEN \
47 -D__COPYRIGHT\(x\)= \
48 -D__RCSID\(x\)=
49# -D_DIAGASSERT\(x\)= \
50# -DHETIO
51
52LIBS = $(LIBC_PREFIX)/libc.a
53DEFS += -DRELEASE=\"$(RELEASE)\"
54
55ifdef REVISION
56 DEFS += "-DREVISION=\"$(REVISION)\""
57endif
58
59ifdef TIMESTAMP
60 DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
61endif
62
63## Sources
64#
65
66OUTPUT = sh
67SHSRCS = \
68 fake.c \
69 alias.c \
70 cd.c \
71 bltin/echo.c \
72 error.c \
73 eval.c \
74 exec.c \
75 expand.c \
76 hetio.c \
77 histedit.c \
78 input.c \
79 jobs.c \
80 mail.c \
81 main.c \
82 memalloc.c \
83 miscbltin.c \
84 mystring.c \
85 options.c \
86 output.c \
87 parser.c \
88 redir.c \
89 show.c \
90 setmode.c \
91 bltin/test.c \
92 bltin/times.c \
93 trap.c \
94 var.c
95
96GENSRCS = \
97 builtins.c \
98 init.c \
99 nodes.c \
100 syntax.c \
101 signames.c
102# lex.yy.c \
103# arith.c \
104# arith.h \
105
106GENHEADERS = \
107 token.h \
108 nodes.h \
109 syntax.h \
110 builtins.h
111
112SOURCES = ${SHSRCS} ${GENSRCS}
113SUBDIRS = tools
114
115OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
116
117.PHONY: all clean depend disasm all-subdirs
118
119all: all-subdirs $(OUTPUT) disasm
120
121all-subdirs:
122 for i in $(SUBDIRS); do \
123 echo "make all in $$i..."; \
124 make -C $$i all; \
125 done
126
127-include Makefile.depend
128
129.ORDER: builtins.c builtins.h
130builtins.c builtins.h: mkbuiltins builtins.def
131 sh mkbuiltins shell.h builtins.def `pwd`
132
133INIT_DEPS = alias.c eval.c exec.c input.c jobs.c options.c parser.c \
134 redir.c trap.c var.c output.c
135
136init.c: mkinit $(INIT_DEPS)
137 ./mkinit $(INIT_DEPS)
138
139signames.c: mksignames
140 ./mksignames
141
142nodes.c nodes.h: mknodes nodetypes nodes.c.pat
143 ./mknodes ./nodetypes ./nodes.c.pat
144
145syntax.c syntax.h: mksyntax
146 ./mksyntax
147
148#arith.c arith.h: arith.y
149# yacc -d arith.y
150# mv y.tab.h arith.h
151# mv y.tab.c arith.c
152
153token.h: mktokens
154 sh ./mktokens
155
156clean:
157 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend
158 -rm -f $(GENSRCS) $(GENHEADERS) $(OBJECTS)
159 for i in $(SUBDIRS); do \
160 echo "make clean in $$i..."; \
161 make -C $$i clean; \
162 done
163
164depend:
165 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) $(GENHEADERS) > Makefile.depend
166
167$(OUTPUT): $(GENSRCS) $(GENHEADERS) $(OBJECTS) $(LIBS)
168 $(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
169
170disasm:
171 $(OBJDUMP) -d $(OUTPUT) >$(OUTPUT).disasm
172
173%.o: %.S
174 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
175
176%.o: %.s
177 $(AS) $(AFLAGS) $< -o $@
178
179%.o: %.c
180 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
Note: See TracBrowser for help on using the repository browser.