Subversion Repositories HelenOS

Rev

Rev 3277 | Go to most recent revision | Details | 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
include ../../Makefile.config
34
 
35
LIBC_PREFIX = ../../lib/libc
36
SOFTINT_PREFIX = ../../lib/softint
37
include $(LIBC_PREFIX)/Makefile.toolchain
38
 
39
CFLAGS += -I../../srv/kbd/include -DHELENOS -fno-strict-aliasing
40
 
41
LIBS = $(LIBC_PREFIX)/libc.a
42
DEFS += -DRELEASE=\"$(RELEASE)\"
43
 
44
ifdef REVISION
45
	DEFS += "-DREVISION=\"$(TIMESTAMP)\""
46
endif
47
 
48
ifdef TIMESTAMP
49
	DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
50
endif
51
 
52
PROGRAM = bdsh
53
 
54
# Any directory that cleaning targets should know about
55
SUBDIRS = \
56
	./ \
57
	cmds/ \
58
	cmds/modules/ \
59
	cmds/modules/help/ \
60
	cmds/modules/quit/ \
61
	cmds/builtins/ \
62
	cmds/builtins/pwd/ \
63
	cmds/builtins/cd/ \
64
	lib/
65
 
66
SOURCES = \
67
	cmds/modules/help/help.c \
68
	cmds/modules/quit/quit.c \
69
	cmds/builtins/pwd/pwd.c \
70
	cmds/builtins/cd/cd.c \
71
	cmds/mod_cmds.c \
72
	cmds/builtin_cmds.c \
73
	errors.c \
74
	input.c \
75
	util.c \
76
	exec.c \
77
	scli.c
78
 
79
CFLAGS += -I. -Icmds/ -Icmds/builtins -Icmds/modules -Ilib -Ilib/ustr
80
 
81
OBJECTS = $(SOURCES:.c=.o)
82
 
83
# For easy cleaning, *.o is already handled
84
CLEANDIRS := $(addsuffix *~,$(SUBDIRS))
85
CLEANDIRS += $(addsuffix *.bak,$(SUBDIRS))
86
CLEANDIRS += $(addsuffix *.tmp,$(SUBDIRS))
87
CLEANDIRS += $(addsuffix *.out,$(SUBDIRS))
88
CLEANDIRS += $(addsuffix *.d,$(SUBDIRS))
89
CLEANDIRS += $(addsuffix *.gch,$(SUBDIRS) )
90
 
91
%.o: %.S
92
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
93
 
94
%.o: %.s
95
	$(AS) $(AFLAGS) $< -o $@
96
 
97
%.o: %.c
98
	$(CC) $(CFLAGS) $(INC) -c $< -o $@
99
	$(CC) -M $(CFLAGS) $(INC) $*.c > $*.d
100
 
101
$(PROGRAM): $(OBJECTS) $(LIBS)
102
	$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
103
 
104
# Everything else is a phony target
105
.PHONY: all clean distclean depend disasm
106
 
107
all: $(PROGRAM) disasm
108
 
109
clean:
110
	@-rm -f $(OBJECTS)
111
	@-rm -f $(PROGRAM)
112
	@-rm -f $(PROGRAM).map
113
	@-rm -f $(PROGRAM).disasm
114
	@-rm -f $(CLEANDIRS)
115
 
116
depend:
117
	@echo ''
118
 
119
disasm:
120
	$(OBJDUMP) -d $(PROGRAM) >$(PROGRAM).disasm
121
 
122
distclean: clean
123
 
124
# Do not delete - dependencies
125
-include $(OBJECTS:.o=.d)