Makefile 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. STATIC_LIBS = libxrcu.a
  2. SHARED_LIBS = libxrcu.so
  3. HEADERS = xrcu.hpp stack.hpp hash_table.hpp skip_list.hpp \
  4. xatomic.hpp lwlock.hpp optional.hpp queue.hpp
  5. OBJS = xrcu.o hash_table.o stack.o lwlock.o skip_list.o queue.o
  6. LOBJS = $(OBJS:.o=.lo)
  7. TEST_OBJS = $(LOBJS)
  8. -include config.mak
  9. ALL_LIBS = $(STATIC_LIBS) $(SHARED_LIBS)
  10. AR = $(CROSS_COMPILE)ar
  11. RANLIB = $(CROSS_COMPILE)ranlib
  12. CXXFLAGS += $(CXXFLAGS_AUTO)
  13. all: $(ALL_LIBS)
  14. check: $(TEST_OBJS)
  15. $(CXX) $(CXXFLAGS) tests/test.cpp $(TEST_OBJS) -o tst
  16. ./tst
  17. %.o: %.cpp $(HEADERS)
  18. $(CXX) $(CXXFLAGS) -c $< -o $@
  19. %.lo: %.cpp $(HEADERS)
  20. $(CXX) $(CXXFLAGS) -fPIC -c $< -o $@
  21. libxrcu.a: $(OBJS)
  22. rm -f $@
  23. $(AR) rc $@ $(OBJS)
  24. $(RANLIB) $@
  25. libxrcu.so: $(LOBJS)
  26. $(CXX) -fPIC -shared $(CXXFLAGS) -o $@ $(LOBJS)
  27. install: $(ALL_LIBS)
  28. mkdir -p $(includedir)/xrcu
  29. cp libxrcu* $(libdir)/
  30. cp $(HEADERS) $(includedir)/xrcu
  31. clean:
  32. rm -rf *.o *.lo libxrcu.* tst