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