| 1 | ############################################################################ |
|---|
| 2 | # Makefile for the "mini-libc" library. # |
|---|
| 3 | ############################################################################ |
|---|
| 4 | |
|---|
| 5 | -include ../../params-soft.mk |
|---|
| 6 | |
|---|
| 7 | ifeq ($(ARCH_NAME),) |
|---|
| 8 | $(error Please define in ARCH_NAME parameter in params-soft.mk!) |
|---|
| 9 | endif |
|---|
| 10 | |
|---|
| 11 | SRCS = ctype.c \ |
|---|
| 12 | dirent.c \ |
|---|
| 13 | fcntl.c \ |
|---|
| 14 | mman.c \ |
|---|
| 15 | signal.c \ |
|---|
| 16 | socket.c \ |
|---|
| 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 | |
|---|
| 26 | OBJS = $(addprefix build/, $(SRCS:.c=.o)) \ |
|---|
| 27 | $(HAL_ARCH)/build/core/hal_user.o |
|---|
| 28 | |
|---|
| 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) |
|---|
| 36 | |
|---|
| 37 | libs : build/lib/libc.a headers |
|---|
| 38 | |
|---|
| 39 | build : |
|---|
| 40 | @mkdir build |
|---|
| 41 | @mkdir build/lib |
|---|
| 42 | @mkdir build/include |
|---|
| 43 | @mkdir build/include/sys |
|---|
| 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 | |
|---|
| 52 | headers: build |
|---|
| 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/. |
|---|
| 58 | cp socket.h build/include/sys/. |
|---|
| 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/. |
|---|
| 67 | |
|---|
| 68 | build/lib/libc.a: build $(OBJS) |
|---|
| 69 | $(AR) rc $@ $(OBJS) |
|---|
| 70 | $(RANLIB) $@ |
|---|
| 71 | |
|---|
| 72 | .PHONY = build clean headers |
|---|
| 73 | |
|---|
| 74 | clean: |
|---|
| 75 | rm -rf build/ |
|---|