1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
## top directory where everything happens
TOPDIR := $(shell pwd)
TARGET := $(TOPDIR)/bin
BUILD := $(TOPDIR)/build
SRC := $(TOPDIR)/src
CC = gcc
CXX = g++
CFLAGS += -g -O3
CXXFLAGS += $(CFLAGS)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the projects
#---------------------------------------------------------------------------------
LIBS := -lm -lgsl -lgslcblas
## create directory structure
makeDirs:
@mkdir -p $(TARGET) $(BUILD)
clean:
rm -rf $(BUILD)
rm -f $(SRC)/*/*.gch
all: makeDirs \
saint-reformat \
saint-spc-noctrl-matrix \
saint-spc-noctrl \
saint-spc-ctrl \
saint-int-ctrl
@echo -e "\n\n### All executables are in $(TOPDIR)/bin ###\n\n"
saint-reformat: makeDirs
$(CC) $(CFLAGS) -c $(SRC)/SAINTreformat/*.c $(SRC)/SAINTreformat/*.h
mv *.o $(BUILD)
$(CC) $(LDFLAGS) $(BUILD)/*.o -o $(TARGET)/saint-reformat $(LIBS)
rm $(BUILD)/*.o
@echo
@echo
saint-spc-noctrl-matrix: makeDirs
$(CC) $(CFLAGS) -c $(SRC)/SAINTspc-noctrl-matrix/*.c $(SRC)/SAINTspc-noctrl-matrix/*.h
mv *.o $(BUILD)
$(CC) $(LDFLAGS) $(BUILD)/*.o -o $(TARGET)/saint-spc-noctrl-matrix $(LIBS)
rm $(BUILD)/*.o
@echo
@echo
saint-spc-noctrl: makeDirs
$(CC) $(CFLAGS) -c $(SRC)/SAINTspc-noctrl/*.c $(SRC)/SAINTspc-noctrl/*.h
mv *.o $(BUILD)
$(CC) $(LDFLAGS) $(BUILD)/*.o -o $(TARGET)/saint-spc-noctrl $(LIBS)
rm $(BUILD)/*.o
@echo
@echo
saint-spc-ctrl: makeDirs
$(CC) $(CFLAGS) -c $(SRC)/SAINTspc-ctrl/*.c $(SRC)/SAINTspc-ctrl/*.h
mv *.o $(BUILD)
$(CC) $(LDFLAGS) $(BUILD)/*.o -o $(TARGET)/saint-spc-ctrl $(LIBS)
rm $(BUILD)/*.o
@echo
@echo
saint-int-ctrl: makeDirs
$(CC) $(CFLAGS) -c $(SRC)/SAINTint-ctrl/*.c $(SRC)/SAINTint-ctrl/*.h
mv *.o $(BUILD)
$(CC) $(LDFLAGS) $(BUILD)/*.o -o $(TARGET)/saint-int-ctrl $(LIBS)
rm $(BUILD)/*.o
@echo
@echo
|