[439] | 1 | ############################################################################ |
---|
[445] | 2 | # Makefile for the "mini-libc" library. # |
---|
[439] | 3 | ############################################################################ |
---|
| 4 | |
---|
| 5 | -include ../../params-soft.mk |
---|
[445] | 6 | |
---|
[439] | 7 | ifeq ($(ARCH_NAME),) |
---|
[677] | 8 | $(error Please define ARCH_NAME parameter in params-soft.mk!) |
---|
[439] | 9 | endif |
---|
| 10 | |
---|
[445] | 11 | SRCS = ctype.c \ |
---|
| 12 | dirent.c \ |
---|
| 13 | fcntl.c \ |
---|
| 14 | mman.c \ |
---|
| 15 | signal.c \ |
---|
[661] | 16 | socket.c \ |
---|
[445] | 17 | stat.c \ |
---|
| 18 | stdio.c \ |
---|
| 19 | stdlib.c \ |
---|
| 20 | string.c \ |
---|
| 21 | strings.c \ |
---|
| 22 | time.c \ |
---|
| 23 | unistd.c \ |
---|
| 24 | wait.c |
---|
| 25 | |
---|
[439] | 26 | OBJS = $(addprefix build/, $(SRCS:.c=.o)) \ |
---|
| 27 | $(HAL_ARCH)/build/core/hal_user.o |
---|
| 28 | |
---|
[445] | 29 | INCLUDES = -I. \ |
---|
| 30 | -I$(LIBPTHREAD_PATH) \ |
---|
| 31 | -I$(LIBALMOSMKH_PATH) \ |
---|
| 32 | -I$(SHARED_INCLUDE) \ |
---|
| 33 | -I$(HAL)/generic \ |
---|
| 34 | -I$(HAL_ARCH)/core \ |
---|
| 35 | -I$(KERNEL) |
---|
[439] | 36 | |
---|
[445] | 37 | libs : build/lib/libc.a headers |
---|
[439] | 38 | |
---|
| 39 | build : |
---|
| 40 | @mkdir build |
---|
| 41 | @mkdir build/lib |
---|
| 42 | @mkdir build/include |
---|
[444] | 43 | @mkdir build/include/sys |
---|
[439] | 44 | |
---|
| 45 | $(HAL_ARCH)/build/core/hal_user.o : |
---|
| 46 | $(MAKE) -C $(HAL_ARCH) |
---|
| 47 | |
---|
| 48 | build/%.o : %.c %.h |
---|
| 49 | $(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $< |
---|
| 50 | $(DU) -D $@ > $@.txt |
---|
| 51 | |
---|
[444] | 52 | headers: build |
---|
[445] | 53 | cp ctype.h build/include/. |
---|
| 54 | cp dirent.h build/include/. |
---|
| 55 | cp fcntl.h build/include/. |
---|
| 56 | cp mman.h build/include/sys/. |
---|
| 57 | cp signal.h build/include/. |
---|
[661] | 58 | cp socket.h build/include/sys/. |
---|
[445] | 59 | cp stat.h build/include/sys/. |
---|
| 60 | cp stdio.h build/include/. |
---|
| 61 | cp stdlib.h build/include/. |
---|
| 62 | cp string.h build/include/. |
---|
| 63 | cp strings.h build/include/. |
---|
| 64 | cp time.h build/include/. |
---|
| 65 | cp unistd.h build/include/. |
---|
| 66 | cp wait.h build/include/sys/. |
---|
[444] | 67 | |
---|
[439] | 68 | build/lib/libc.a: build $(OBJS) |
---|
| 69 | $(AR) rc $@ $(OBJS) |
---|
[440] | 70 | $(RANLIB) $@ |
---|
[439] | 71 | |
---|
[444] | 72 | .PHONY = build clean headers |
---|
[439] | 73 | |
---|
| 74 | clean: |
---|
[444] | 75 | rm -rf build/ |
---|