makefile 480 B

12345678910111213141516171819202122232425
  1. ARCH ?= intel64
  2. .PHONE: lib clean
  3. all: lib
  4. cp $(ARCH)/libm.a libm.a
  5. ifeq ($(ARCH),ia32)
  6. CFLAGS := -m32
  7. endif
  8. SRC_FILES := $(wildcard $(ARCH)/*.S)
  9. OBJ_FILES := $(SRC_FILES:.S=.o)
  10. STATIC_LIB:= $(ARCH)/libm.a
  11. SHARED_LIB:= $(ARCH)/libm.so
  12. lib : $(STATIC_LIB) $(SHARED_LIB)
  13. %.o : %.S
  14. gcc $(CFLAGS) -c $< -o $@
  15. $(STATIC_LIB) : $(OBJ_FILES)
  16. ar crv $@ $^
  17. $(SHARED_LIB) : $(OBJ_FILES)
  18. gcc $(CFLAGS) -shared -o $@ $^
  19. clean:
  20. -rm -rf $(OBJ_FILES) $(STATIC_LIB) $(SHARED_LIB) libm.a