Makefile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. INC_PATH = inc
  2. SRC_PATH = src
  3. OBJ_PATH = obj
  4. BIN_PATH = bin
  5. PRSONA_PATH = .
  6. PRSONA_INC_PATH = $(PRSONA_PATH)/$(INC_PATH)
  7. PRSONA_SRC_PATH = $(PRSONA_PATH)/$(SRC_PATH)
  8. PRSONA_OBJ_PATH = $(PRSONA_PATH)/$(OBJ_PATH)
  9. PRSONA_BIN_PATH = $(PRSONA_PATH)/$(BIN_PATH)
  10. BGN_PATH = ../BGN2/bgn2
  11. BGN_INC_PATH = $(BGN_PATH)/$(INC_PATH)
  12. BGN_SRC_PATH = $(BGN_PATH)/$(SRC_PATH)
  13. BGN_OBJ_PATH = $(BGN_PATH)/$(OBJ_PATH)
  14. BGN_BIN_PATH = $(BGN_PATH)/$(BIN_PATH)
  15. 666_PATH = ../BGN2/dclxvi-20130329
  16. 666_INC_PATH = $(666_PATH)/$(INC_PATH)
  17. 666_SRC_PATH = $(666_PATH)/$(SRC_PATH)
  18. 666_OBJ_PATH = $(666_PATH)/$(OBJ_PATH)
  19. 666_BIN_PATH = $(666_PATH)/$(BIN_PATH)
  20. CPP = g++
  21. CPPFLAGS = -std=c++14 -Wall -I$(PRSONA_INC_PATH) -I$(BGN_INC_PATH) -I$(666_INC_PATH) -O2
  22. LDFLAGS = -lgmp -lgmpxx
  23. CC = gcc
  24. CFLAGS = -std=c99 -O3 -fomit-frame-pointer -I$(666_INC_PATH)
  25. C_LDFLAGS = -lm
  26. all: $(PRSONA_BIN_PATH) $(PRSONA_OBJ_PATH) $(BGN_OBJ_PATH) $(666_OBJ_PATH) $(PRSONA_BIN_PATH)/main
  27. $(PRSONA_BIN_PATH):
  28. mkdir -p $@
  29. $(PRSONA_OBJ_PATH):
  30. mkdir -p $@
  31. $(BGN_OBJ_PATH):
  32. mkdir -p $@
  33. $(666_OBJ_PATH):
  34. mkdir -p $@
  35. PRSONA_FULL_SRC = $(wildcard $(PRSONA_SRC_PATH)/*.cpp)
  36. PRSONA_SRC = $(filter-out $(PRSONA_SRC_PATH)/main.cpp, $(PRSONA_FULL_SRC))
  37. PRSONA_OBJ = $(patsubst $(PRSONA_SRC_PATH)/%.cpp, $(PRSONA_OBJ_PATH)/%.o, $(PRSONA_SRC))
  38. $(PRSONA_OBJ_PATH)/%.o: $(PRSONA_SRC_PATH)/%.cpp
  39. $(CPP) $(CPPFLAGS) -DQHASM -c -o $@ $<
  40. BGN_FULL_SRC = $(wildcard $(BGN_SRC_PATH)/*.cpp)
  41. BGN_SRC = $(filter-out $(BGN_SRC_PATH)/main.cpp, $(BGN_FULL_SRC))
  42. BGN_OBJ = $(patsubst $(BGN_SRC_PATH)/%.cpp, $(BGN_OBJ_PATH)/%.o, $(BGN_SRC))
  43. $(BGN_OBJ_PATH)/%.o: $(BGN_SRC_PATH)/%.cpp
  44. $(CPP) $(CPPFLAGS) -DQHASM -c -o $@ $<
  45. 666_ALL_C_SRC = $(wildcard $(666_SRC_PATH)/*.c)
  46. 666_C_SRC = $(filter-out $(666_SRC_PATH)/bilintest.c $(666_SRC_PATH)/speedtest.c $(666_SRC_PATH)/test_curvepoint_multiscalar.c $(666_SRC_PATH)/test_twistpoint_multiscalar.c $(666_SRC_PATH)/twistpoint_fp2_multiscalar.c $(666_SRC_PATH)/curvepoint_fp_multiscalar.c, $(666_ALL_C_SRC))
  47. 666_C_OBJ = $(patsubst $(666_SRC_PATH)/%.c, $(666_OBJ_PATH)/%_c_with_as.o, $(666_C_SRC))
  48. $(666_OBJ_PATH)/%_c_with_as.o: $(666_SRC_PATH)/%.c $(666_INC_PATH)/%.h
  49. $(CC) $(CFLAGS) -DQHASM -c -o $@ $<
  50. 666_AS_SRC = $(wildcard $(666_SRC_PATH)/*.s)
  51. 666_AS_OBJ = $(patsubst $(666_SRC_PATH)/%.s, $(666_OBJ_PATH)/%_as.o, $(666_AS_SRC))
  52. $(666_OBJ_PATH)/%_as.o: $(666_SRC_PATH)/%.s
  53. $(CC) $(CFLAGS) -fPIC -c -o $@ $^
  54. $(BGN_OBJ_PATH)/bgn.a: $(BGN_OBJ) $(666_AS_OBJ) $(666_C_OBJ)
  55. rm -f $@
  56. ar cr $@ $^
  57. $(PRSONA_BIN_PATH)/main: $(PRSONA_OBJ_PATH)/main.o $(PRSONA_OBJ) $(BGN_OBJ_PATH)/bgn.a
  58. $(CPP) $(CPPFLAGS) -no-pie -o $@ $^ $(LDFLAGS)
  59. .PHONY: clean
  60. clean: prsona_clean bgn_clean 666_clean
  61. prsona_clean:
  62. -rm $(PRSONA_BIN_PATH)/*
  63. -rm $(PRSONA_OBJ_PATH)/*
  64. bgn_clean:
  65. -rm $(BGN_OBJ_PATH)/*
  66. 666_clean:
  67. -rm $(666_OBJ_PATH)/*