Makefile 608 B

123456789101112131415161718192021222324
  1. .PHONY: default clean
  2. LDLIBS=../../obj/libst.a -ldl
  3. CFLAGS=-g -O0 -rdynamic -I../../obj
  4. OS_NAME = $(shell uname -s)
  5. ST_TARGET = linux-debug
  6. ifeq ($(OS_NAME), Darwin)
  7. ST_TARGET = darwin-debug
  8. CPU_ARCHS = $(shell g++ -dM -E - </dev/null |grep -q '__x86_64' && echo x86_64)
  9. CPU_ARCHS += $(shell g++ -dM -E - </dev/null |grep -q '__aarch64' && echo arm64)
  10. CFLAGS += -arch $(CPU_ARCHS)
  11. endif
  12. ./backtrace: backtrace.c $(LDLIBS)
  13. $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o $@ $^ $(LDLIBS)
  14. clean:
  15. cd ../.. && make clean
  16. rm -rf backtrace backtrace.dSYM
  17. $(LDLIBS):
  18. cd ../.. && make $(ST_TARGET)