makefile 503 B

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