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