New developer version 0.6.8; added select () function; added demonstrating example...
[ZeXOS.git] / kernel / lib / Makefile
blobece4db20471132f830c657e9f410cae41d77cced
1 .SUFFIXES: .asm
3 # defines
4 MAKEFILE=Makefile
5 MAKEDEP=$(MAKEFILE)
6 INCDIR =../include
7 NASM =nasm -f elf -i$(INCDIR)/
8 CFLAGS =-g -Wall -W -O2 -nostdinc -fno-builtin -fno-stack-protector -Wno-unused-parameter -I$(INCDIR) -I../build/main
9 CCASM =$(CC) -D__ASSEMBLY__ -g -Os -pipe -mcpu=arm926ej-s -mabi=apcs-gnu -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -fno-builtin -ffreestanding -nostdinc
10 STDIO =stdio/doprintf.o stdio/delay.o stdio/kprintf.o stdio/printf.o stdio/sprintf.o stdio/open.o stdio/close.o stdio/write.o stdio/read.o
11 STDLIB =stdlib/atoi.o stdlib/abort.o stdlib/strtol.o
12 STRING =string/memsetw.o string/memcpy.o string/strlen.o string/strcpy.o string/strcat.o string/memset.o string/strcmp.o
13 ARCHDEP =x86/dma.o x86/setjmp.o x86/longjmp.o
14 CTYPE =ctype/ctype.o
15 UNISTD =unistd/fcntl.o unistd/lseek.o unistd/pipe.o
16 SYS =sys/select.o
18 ifeq ($(ARCH),arm)
19 CFLAGS=-g -Os -fno-builtin -ffreestanding -nostdinc -pipe -mcpu=arm926ej-s -mabi=apcs-gnu -nostdlib -nostartfiles -nodefaultlibs -ffixed-r8 -msoft-float -I$(INCDIR) -I../build/main
20 ARCHDEP=arm/divsi3.o arm/div0.o arm/modsi3.o
21 endif
23 OBJS =$(STDIO) $(STDLIB) $(STRING) $(ARCHDEP) $(CTYPE) $(UNISTD) $(SYS) $(ARCHDEP)
25 ifneq ($(V),1)
26 Q := @
27 endif
29 # targets
30 all: $(OBJS) libc.a
32 clean:
33 $(Q)rm -f libc.a $(OBJS)
34 @printf " CLEAN\n";
36 # implicit rules
37 .s.o:
38 @printf " ASM $(subst $(shell pwd)/,,$(@))\n";
39 $(Q)$(NASM) -o$@ $<
41 .S.o:
42 @printf " ASM $(subst $(shell pwd)/,,$(@))\n";
43 $(Q)$(CCASM) -c -o$@ $<
45 .c.o:
46 @printf " CC $(subst $(shell pwd)/,,$(@))\n";
47 $(Q)$(CC) $(CFLAGS) -c -o$@ $<
49 # explicit rules
50 libc.a: $(OBJS) $(MAKEDEP)
51 @printf " AR $(subst $(shell pwd)/,,$(@))\n";
52 $(Q)$(AR) rcs libc.a $(OBJS)