Rev 267 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | # |
2 | # The standard lib C |
||
3 | # |
||
4 | |||
5 | ifndef BASE |
||
6 | BASE=.. |
||
7 | endif |
||
8 | |||
9 | include $(BASE)/config/config.mk |
||
10 | |||
11 | LIBRARY = c |
||
12 | |||
13 | OBJS_PATH = $(BASE)/libc |
||
14 | |||
15 | SRCS= init.c |
||
16 | |||
17 | OBJS= $(patsubst %.c,%.o,$(SRCS)) |
||
18 | |||
19 | install: all $(LIB_PATH)/lib$(LIBRARY).a |
||
20 | |||
21 | clean cleanall depend:: |
||
22 | make -C libio $@ |
||
23 | make -C quad $@ |
||
24 | make -C stdio $@ |
||
25 | make -C stdlib $@ |
||
26 | make -C assert $@ |
||
27 | make -C unistd $@ |
||
28 | make -C utsname $@ |
||
29 | make -C ctype $@ |
||
30 | make -C string $@ |
||
267 | giacomo | 31 | make -C getopt $@ |
2 | pj | 32 | |
33 | |||
34 | # |
||
35 | # Dependency rules used to make a library |
||
36 | # derived directly from /config/lib.mak |
||
37 | # |
||
38 | |||
39 | .PHONY: all install clean cleanall depend |
||
40 | |||
41 | # |
||
42 | |||
43 | all: $(OBJS) |
||
44 | make -C libio $@ |
||
45 | make -C quad $@ |
||
46 | make -C stdio $@ |
||
47 | make -C stdlib $@ |
||
48 | make -C assert $@ |
||
49 | make -C unistd $@ |
||
50 | make -C utsname $@ |
||
51 | make -C ctype $@ |
||
52 | make -C string $@ |
||
267 | giacomo | 53 | make -C getopt $@ |
2 | pj | 54 | $(AR) rs lib$(LIBRARY).a $(OBJS) |
55 | |||
56 | clean:: |
||
57 | $(RM) *.o |
||
58 | $(RM) *.err |
||
59 | $(RM) lib$(LIBRARY).a |
||
60 | |||
61 | cleanall:: clean |
||
62 | $(RM) deps |
||
63 | $(RM) *.bak |
||
64 | $(RM) *.~ |
||
65 | $(RM) *.?~ |
||
66 | $(RM) *.??~ |
||
67 | $(RM) $(LIBRARYPATHNAME) |
||
68 | |||
69 | depend:: |
||
70 | $(CC) $(C_OPT) -M $(OBJS:.o=.c) > deps |
||
71 | |||
72 | deps: |
||
73 | $(CC) $(C_OPT) -M $(OBJS:.o=.c) > deps |
||
74 | |||
75 | ifneq ($(MAKECMDGOALS),clean) |
||
76 | ifneq ($(MAKECMDGOALS),cleanall) |
||
77 | include deps |
||
78 | endif |
||
79 | endif |
||
80 | |||
1025 | mauro | 81 | # Common rules |
82 | %.o : %.s |
||
83 | $(REDIR) $(CC) $(ASM_OPT) $(ASM_OUTPUT) -c $< |
||
84 | %.o : %.c |
||
85 | $(REDIR) $(CC) $(C_OPT) $(C_OUTPUT) -c $< |
||
86 | %.s : %.c |
||
87 | $(REDIR) $(CC) $(C_OPT) $(C_OUTPUT) -S $< |
||
88 | %.o : %.cpp |
||
89 | $(REDIR) $(CPP) $(C_OPT) $(C_OUTPUT) -c $< |
||
90 | |||
2 | pj | 91 | $(LIB_PATH)/lib$(LIBRARY).a: lib$(LIBRARY).a copylibrary |
92 | |||
93 | copylibrary: |
||
94 | $(CP) lib$(LIBRARY).a $(LIBRARYDIR) |
||
95 |