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