platform.mk 876 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. PLAT ?= none
  2. PLATS = linux freebsd macosx
  3. CC ?= gcc
  4. .PHONY : none $(PLATS) clean all cleanall
  5. #ifneq ($(PLAT), none)
  6. .PHONY : default
  7. default :
  8. $(MAKE) $(PLAT)
  9. #endif
  10. none :
  11. @echo "Please do 'make PLATFORM' where PLATFORM is one of these:"
  12. @echo " $(PLATS)"
  13. SKYNET_LIBS := -lpthread -lm
  14. SHARED := -fPIC --shared
  15. EXPORT := -Wl,-E
  16. linux : PLAT = linux
  17. macosx : PLAT = macosx
  18. freebsd : PLAT = freebsd
  19. macosx : SHARED := -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup
  20. macosx : EXPORT :=
  21. macosx linux : SKYNET_LIBS += -ldl
  22. linux freebsd : SKYNET_LIBS += -lrt
  23. # Turn off jemalloc and malloc hook on macosx
  24. macosx : MALLOC_STATICLIB :=
  25. macosx : SKYNET_DEFINES :=-DNOUSE_JEMALLOC
  26. linux macosx freebsd :
  27. $(MAKE) all PLAT=$@ SKYNET_LIBS="$(SKYNET_LIBS)" SHARED="$(SHARED)" EXPORT="$(EXPORT)" MALLOC_STATICLIB="$(MALLOC_STATICLIB)" SKYNET_DEFINES="$(SKYNET_DEFINES)"