Subversion Repositories Kolibri OS

Rev

Rev 8625 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. AR = ar -rcs
  2. CLINK = ../linuxtools/clink
  3. KPACK = kpack
  4.  
  5. INCLUDE = include
  6. LIB_DIR = ../lib
  7.  
  8. LIBC.A = $(LIB_DIR)/libc.a
  9. LIBC.OBJ = $(LIB_DIR)/libc.obj
  10.  
  11. CFLAGS = -I$(INCLUDE) -m32 -nostdinc -nostdlib -DGNUC -Os -fno-common -fno-builtin -fno-leading-underscore -fno-pie
  12. DIRS :=  string stdlib stdio sys math ctype exports setjmp shell_api
  13.  
  14. cfiles := $(foreach dir,$(DIRS),$(patsubst %.c, %.o, $(wildcard $(dir)/*.c)))
  15. asmfiles := $(foreach dir,$(DIRS),$(patsubst %.s, %.o, $(wildcard $(dir)/*.s)))
  16. .PHONY: clean all
  17.  
  18. ifdef windir
  19. cfiles := $(subst /,\,$(cfiles))
  20. asmfiles := $(subst /,\,$(asmfiles))
  21. LIB_DIR := $(subst /,\,$(LIB_DIR))
  22. LIBNAME := $(subst /,\,$(LIBNAME))
  23. RM = del /F /Q
  24. MKDIR_P = md
  25. else
  26. RM = rm -rf
  27. MKDIR_P = mkdir -p
  28. endif
  29.  
  30. all: $(cfiles) $(asmfiles) $(LIB_DIR) $(LIBC.A)
  31.         fasm crt/crt0.asm $(LIB_DIR)/crt0.o
  32.  
  33. $(LIBC.A): $(cfiles) $(asmfiles)
  34.         $(AR) $(LIBC.A) $^
  35.  
  36. $(LIB_DIR):
  37.         $(MKDIR_P) $(LIB_DIR)
  38.  
  39. $(asmfiles):
  40.         $(CC) -E -x c -nostdinc -Imath $*.s > $*.sx
  41.         $(AS) --32 $*.sx -o $*.o
  42.         $(RM) $*.sx
  43.  
  44. clean:
  45.         $(RM) $(cfiles) $(asmfiles)
  46.         $(RM) $(LIBNAME)
  47.  
  48. shared: $(cfiles) $(asmfiles)
  49.         $(CLINK) $^
  50.         #$(KPACK) a.out.obj
  51.         mv a.out.obj $(LIBC.OBJ)
  52.  
  53. test:
  54.         make -C ../test -f Makefile.tcc
  55.         kex ../test/test
  56.