Subversion Repositories HelenOS

Rev

Rev 4342 | Rev 4354 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3265 post 1
# Copyright (c) 2005,  Martin Decky
2
# All rights reserved.
3
# Copyright (c) 2008, Tim Post <tinkertim@gmail.com>
4
# All rights reserved.
5
#
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions are met:
8
#
9
# Redistributions of source code must retain the above copyright notice, this
10
# list of conditions and the following disclaimer.
11
#
12
# Redistributions in binary form must reproduce the above copyright notice,
13
# this list of conditions and the following disclaimer in the documentation
14
# and/or other materials provided with the distribution.
15
#
16
# Neither the name of the original program's authors nor the names of its
17
# contributors may be used to endorse or promote products derived from this
18
# software without specific prior written permission.
19
#
20
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
# POSSIBILITY OF SUCH DAMAGE.
31
 
32
include ../../../version
33
 
34
LIBC_PREFIX = ../../lib/libc
35
SOFTINT_PREFIX = ../../lib/softint
3563 svoboda 36
RTLD_PREFIX = ../../lib/rtld
4342 svoboda 37
 
3265 post 38
include $(LIBC_PREFIX)/Makefile.toolchain
3563 svoboda 39
include $(LIBC_PREFIX)/Makefile.app
3265 post 40
 
3304 post 41
CFLAGS += -I../../srv/kbd/include
3265 post 42
 
4342 svoboda 43
DEFS += -DRELEASE=$(RELEASE)
3265 post 44
 
45
PROGRAM = bdsh
46
 
47
# Any directory that cleaning targets should know about
48
SUBDIRS = \
49
	./ \
50
	cmds/ \
51
	cmds/modules/ \
52
	cmds/modules/help/ \
3277 post 53
	cmds/modules/mkdir/ \
54
	cmds/modules/rm/ \
55
	cmds/modules/cat/ \
56
	cmds/modules/touch/ \
57
	cmds/modules/ls/ \
3371 post 58
	cmds/modules/pwd/ \
3448 svoboda 59
	cmds/modules/sleep/ \
60
	cmds/modules/cp/ \
4347 svoboda 61
	cmds/modules/kcon/ \
3265 post 62
	cmds/builtins/ \
4341 svoboda 63
	cmds/builtins/exit/\
3374 post 64
	cmds/builtins/cd/
3265 post 65
 
66
SOURCES = \
67
	cmds/modules/help/help.c \
3277 post 68
	cmds/modules/mkdir/mkdir.c \
69
	cmds/modules/rm/rm.c \
70
	cmds/modules/cat/cat.c \
71
	cmds/modules/touch/touch.c \
72
	cmds/modules/ls/ls.c \
3371 post 73
	cmds/modules/pwd/pwd.c \
3448 svoboda 74
	cmds/modules/sleep/sleep.c \
75
	cmds/modules/cp/cp.c \
4347 svoboda 76
	cmds/modules/kcon/kcon.c \
4341 svoboda 77
	cmds/builtins/exit/exit.c \
3265 post 78
	cmds/builtins/cd/cd.c \
79
	cmds/mod_cmds.c \
80
	cmds/builtin_cmds.c \
81
	errors.c \
82
	input.c \
83
	util.c \
84
	exec.c \
85
	scli.c
86
 
3374 post 87
CFLAGS += -I. -Icmds/ -Icmds/builtins -Icmds/modules
3265 post 88
 
89
OBJECTS = $(SOURCES:.c=.o)
90
 
91
# For easy cleaning, *.o is already handled
92
CLEANDIRS := $(addsuffix *~,$(SUBDIRS))
93
CLEANDIRS += $(addsuffix *.bak,$(SUBDIRS))
94
CLEANDIRS += $(addsuffix *.tmp,$(SUBDIRS))
95
CLEANDIRS += $(addsuffix *.out,$(SUBDIRS))
96
CLEANDIRS += $(addsuffix *.d,$(SUBDIRS))
97
CLEANDIRS += $(addsuffix *.gch,$(SUBDIRS) )
98
 
99
%.o: %.S
100
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
101
 
102
%.o: %.s
103
	$(AS) $(AFLAGS) $< -o $@
104
 
105
%.o: %.c
106
	$(CC) $(CFLAGS) $(INC) -c $< -o $@
3299 post 107
	@$(CC) -M $(CFLAGS) $(INC) $*.c > $*.d
3265 post 108
 
109
$(PROGRAM): $(OBJECTS) $(LIBS)
3563 svoboda 110
	$(LD) -T $(LD_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(PROGRAM).map
3265 post 111
 
112
# Everything else is a phony target
113
.PHONY: all clean distclean depend disasm
114
 
115
all: $(PROGRAM) disasm
116
 
117
clean:
118
	@-rm -f $(OBJECTS)
119
	@-rm -f $(PROGRAM)
120
	@-rm -f $(PROGRAM).map
121
	@-rm -f $(PROGRAM).disasm
122
	@-rm -f $(CLEANDIRS)
123
 
124
depend:
125
	@echo ''
126
 
127
disasm:
128
	$(OBJDUMP) -d $(PROGRAM) >$(PROGRAM).disasm
129
 
130
distclean: clean
131
 
132
# Do not delete - dependencies
133
-include $(OBJECTS:.o=.d)