Subversion Repositories HelenOS

Rev

Rev 4389 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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