Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Define compiler
  2. CXX = g++
  3. # Define flags
  4. CFLAGS = $(shell root-config --cflags) -fPIC -Wall -pipe -std=c++11 -I.
  5. LIBS = $(shell root-config --glibs) -lEG
  6. INCS = $(shell root-config --incdir)
  7. # Define output library
  8. UNIGEN = libUniGen.so
  9. # Compile all *.cxx classes in the directory
  10. SRC = $(shell find . -name "*.cxx")
  11. all: CFLAGS += -O2
  12. all: $(UNIGEN)
  13. .PHONY: optdebug debug
  14. optdebug: CFLAGS += -O2 -g
  15. optdebug: $(UNIGEN)
  16. debug: CFLAGS += -O0 -g
  17. debug: $(UNIGEN)
  18. # $(SRC:.cc=.o)
  19. $(UNIGEN): $(SRC:.cxx=.o) UniGen_Dict.C
  20. $(CXX) $(CFLAGS) -shared $^ -o $(UNIGEN) $(LIBS)
  21. %.o: %.cxx
  22. $(CXX) -fPIC $(CFLAGS) -c -o $@ $<
  23. # Dictionary deneration: -DROOT_CINT -D__ROOT__
  24. UniGen_Dict.C: $(shell find . -name "*.h" ! -name "*LinkDef*")
  25. rootcint -f $@ -c -I. -I$(INCS) $^ UniGenLinkDef.h
  26. .PHONY: clean distclean converters converters_debug converters_optdebug
  27. clean:
  28. rm -vf *.o UniGen_Dict*
  29. distclean:
  30. rm -vf *.o UniGen_Dict* $(UNIGEN) urqmd2u
  31. converters_debug: CFLAGS += -O0 -g
  32. converters_debug: converters
  33. converters_optdebug: CFLAGS += -O2 -g
  34. converters_optdebug: converters
  35. converters: urqmd2u.cpp
  36. $(CXX) $(CFLAGS) -I$(INCS) $^ -o $(patsubst %.cpp,%,$<) -L. -l$(patsubst lib%.so,%,$(UNIGEN)) $(LIBS)