Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. INC_PATH = inc
  2. SRC_PATH = src
  3. OBJ_PATH = obj
  4. BIN_PATH = bin
  5. BGN_PATH = .
  6. BGN_INC_PATH = $(BGN_PATH)/$(INC_PATH)
  7. BGN_SRC_PATH = $(BGN_PATH)/$(SRC_PATH)
  8. BGN_OBJ_PATH = $(BGN_PATH)/$(OBJ_PATH)
  9. BGN_BIN_PATH = $(BGN_PATH)/$(BIN_PATH)
  10. 666_PATH = ../dclxvi-20130329
  11. 666_INC_PATH = $(666_PATH)/$(INC_PATH)
  12. 666_SRC_PATH = $(666_PATH)/$(SRC_PATH)
  13. 666_OBJ_PATH = $(666_PATH)/$(OBJ_PATH)
  14. 666_BIN_PATH = $(666_PATH)/$(BIN_PATH)
  15. CPP = g++
  16. CPPFLAGS = -std=c++14 -Wall -I$(BGN_INC_PATH) -I$(666_INC_PATH) -O2
  17. LDFLAGS = -lgmp -lgmpxx
  18. CC = gcc
  19. CFLAGS = -std=c99 -O3 -fomit-frame-pointer -I$(666_INC_PATH)
  20. C_LDFLAGS = -lm
  21. all: $(BGN_BIN_PATH) $(BGN_OBJ_PATH) $(666_OBJ_PATH) $(BGN_BIN_PATH)/main
  22. $(BGN_BIN_PATH):
  23. mkdir -p $@
  24. $(BGN_OBJ_PATH):
  25. mkdir -p $@
  26. $(666_OBJ_PATH):
  27. mkdir -p $@
  28. BGN_FULL_SRC = $(wildcard $(BGN_SRC_PATH)/*.cpp)
  29. BGN_SRC = $(filter-out $(BGN_SRC_PATH)/main.cpp, $(BGN_FULL_SRC))
  30. BGN_OBJ = $(patsubst $(BGN_SRC_PATH)/%.cpp, $(BGN_OBJ_PATH)/%.o, $(BGN_SRC))
  31. $(BGN_OBJ_PATH)/%.o: $(BGN_SRC_PATH)/%.cpp
  32. $(CPP) $(CPPFLAGS) -DQHASM -c -o $@ $<
  33. 666_ALL_C_SRC = $(wildcard $(666_SRC_PATH)/*.c)
  34. 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))
  35. 666_C_OBJ = $(patsubst $(666_SRC_PATH)/%.c, $(666_OBJ_PATH)/%_c_with_as.o, $(666_C_SRC))
  36. $(666_OBJ_PATH)/%_c_with_as.o: $(666_SRC_PATH)/%.c $(666_INC_PATH)/%.h
  37. $(CC) $(CFLAGS) -DQHASM -c -o $@ $<
  38. 666_AS_SRC = $(wildcard $(666_SRC_PATH)/*.s)
  39. 666_AS_OBJ = $(patsubst $(666_SRC_PATH)/%.s, $(666_OBJ_PATH)/%_as.o, $(666_AS_SRC))
  40. $(666_OBJ_PATH)/%_as.o: $(666_SRC_PATH)/%.s
  41. $(CC) $(CFLAGS) -fPIC -c -o $@ $^
  42. $(BGN_OBJ_PATH)/bgn.a: $(BGN_OBJ) $(666_AS_OBJ) $(666_C_OBJ)
  43. rm -f $@
  44. ar cr $@ $^
  45. $(BGN_BIN_PATH)/main: $(BGN_OBJ_PATH)/main.o $(BGN_OBJ_PATH)/bgn.a
  46. $(CPP) $(CPPFLAGS) -no-pie -o $@ $^ $(LDFLAGS)
  47. .PHONY: clean
  48. clean: bgn_clean 666_clean
  49. bgn_clean:
  50. -rm $(BIN_PATH)/*
  51. -rm $(OBJ_PATH)/*
  52. 666_clean:
  53. -rm $(666_OBJ_PATH)/*