Cleanup in elf.c with .bss section clean; adm command mounts cdrom instead of floppy...
[ZeXOS.git] / libc / Makefile
blob3647d45340a3db71b47b1ab9eeb127f85bf881d6
1 .SUFFIXES: .asm
3 # defines
4 MAKEFILE=Makefile
5 MAKEDEP=$(MAKEFILE)
6 INCDIR =./include
7 NASM =nasm -f elf -i$(INCDIR)/
8 AR :=ar
9 CC :=gcc -m32
10 CCLIBC =$(CC) -g -Wall -W -O2 -nostdinc -fno-builtin -Wno-unused-parameter -I$(INCDIR)
13 STDIO =stdio/doprintf.o stdio/delay.o stdio/printf.o stdio/sprintf.o stdio/puts.o stdio/putch.o stdio/cls.o stdio/getch.o stdio/getkey.o stdio/gotoxy.o stdio/setcolor.o stdio/beep.o stdio/open.o stdio/close.o stdio/read.o stdio/write.o stdio/doscanf.o stdio/scanf.o stdio/getchar.o stdio/putchar.o stdio/fopen.o stdio/fclose.o stdio/fread.o stdio/fwrite.o stdio/fgetc.o stdio/fgets.o stdio/feof.o stdio/fileno.o stdio/fseek.o stdio/ftell.o stdio/fprintf.o stdio/fputc.o stdio/fdopen.o stdio/ferror.o stdio/fflush.o stdio/clearerr.o stdio/perror.o stdio/putc.o stdio/dosscanf.o stdio/sscanf.o stdio/fputs.o stdio/remove.o stdio/rename.o
14 STRING =string/memset.o string/memsetw.o string/memcpy.o string/memcmp.o string/memchr.o string/strlen.o string/strchr.o string/strcpy.o string/strncpy.o string/strcat.o string/strncat.o string/strcmp.o string/strstr.o string/strspn.o string/strdup.o string/strndup.o string/strpbrk.o string/strerror.o string/memmove.o
15 STRINGS =strings/strcasecmp.o
16 STDLIB =stdlib/memory.o stdlib/exit.o stdlib/schedule.o stdlib/strtol.o stdlib/atoi.o stdlib/itoa.o stdlib/abort.o stdlib/abs.o stdlib/system.o stdlib/rand.o stdlib/random.o stdlib/getenv.o stdlib/strtoul.o stdlib/mkstemp.o stdlib/qsort.o
17 UNISTD =unistd/sleep.o unistd/fcntl.o unistd/dup.o unistd/lseek.o unistd/unlink.o unistd/pipe.o unistd/getpid.o unistd/chdir.o unistd/getcwd.o unistd/access.o
18 SOCKET =socket/connect.o socket/socket.o socket/send.o socket/gethostbyname.o socket/htons.o socket/recv.o socket/bind.o socket/listen.o socket/accept.o socket/sendto.o socket/recvfrom.o socket/inet_ntop.o socket/inet_pton.o socket/inet_ntoa.o socket/setsockopt.o socket/inet_addr.o
19 SIGNAL =signal/signal.o
20 VFS =vfs/mount.o
21 TIME =time/time.o time/localtime.o time/gettimeofday.o time/mktime.o
22 CTYPE =ctype/ctype.o
23 ERRNO =errno/errno.o
24 SYS =sys/ioctl.o sys/creat.o sys/mkdir.o sys/rmdir.o sys/select.o sys/stat.o sys/lstat.o sys/umask.o sys/chmod.o
25 DIRENT =dirent/opendir.o dirent/readdir.o dirent/closedir.o
27 OBJS =$(STDIO) $(STRING) $(STRINGS) $(STDLIB) $(UNISTD) $(SOCKET) $(SIGNAL) $(VFS) $(TIME) $(CTYPE) $(ERRNO) $(SYS) $(DIRENT)
29 ifneq ($(V),1)
30 Q := @
31 endif
33 # targets
34 all: $(OBJS) libc.a
36 clean:
37 $(Q)rm -f libc.a $(OBJS)
38 @printf " CLEAN\n";
40 # implicit rules
41 .S.o:
42 @printf " ASM $(subst $(shell pwd)/,,$(@))\n";
43 $(Q)$(NASM) -o$@ $<
45 .c.o:
46 @printf " CC $(subst $(shell pwd)/,,$(@))\n";
47 $(Q)$(CCLIBC) -c -o$@ $<
49 # explicit rules
50 libc.a: $(OBJS) $(MAKEDEP)
51 @printf " AR $(subst $(shell pwd)/,,$(@))\n";
52 $(Q)$(AR) rcs libc.a $(OBJS)