1PACKAGES = marbles/test stmlib/utils marbles/ramp marbles/random marbles stmlib/dsp 2 3VPATH = $(PACKAGES) 4 5TARGET = marbles_test 6BUILD_ROOT = build/ 7BUILD_DIR = $(BUILD_ROOT)$(TARGET)/ 8CC_FILES = marbles_test.cc \ 9 lag_processor.cc \ 10 output_channel.cc \ 11 quantizer.cc \ 12 discrete_distribution_quantizer.cc \ 13 ramp_extractor.cc \ 14 random.cc \ 15 resources.cc \ 16 units.cc \ 17 t_generator.cc \ 18 x_y_generator.cc 19OBJ_FILES = $(CC_FILES:.cc=.o) 20OBJS = $(patsubst %,$(BUILD_DIR)%,$(OBJ_FILES)) $(STARTUP_OBJ) 21DEPS = $(OBJS:.o=.d) 22DEP_FILE = $(BUILD_DIR)depends.mk 23 24all: marbles_test 25 26$(BUILD_DIR): 27 mkdir -p $(BUILD_DIR) 28 29$(BUILD_DIR)%.o: %.cc 30 g++ -c -DTEST -g -Wall -Werror -msse2 -Wno-unused-variable -O2 -I. $< -o $@ 31 32$(BUILD_DIR)%.d: %.cc 33 g++ -MM -DTEST -I. $< -MF $@ -MT $(@:.d=.o) 34 35marbles_test: $(OBJS) 36 g++ -g -o $(TARGET) $(OBJS) -Wl,-no_pie -lm -lprofiler -L/opt/local/lib 37 38depends: $(DEPS) 39 cat $(DEPS) > $(DEP_FILE) 40 41$(DEP_FILE): $(BUILD_DIR) $(DEPS) 42 cat $(DEPS) > $(DEP_FILE) 43 44profile: marbles_test 45 env CPUPROFILE_FREQUENCY=1000 CPUPROFILE=$(BUILD_DIR)/marbles.prof ./marbles_test && pprof --pdf ./marbles_test $(BUILD_DIR)/marbles.prof > profile.pdf && open profile.pdf 46 47clean: 48 rm $(BUILD_DIR)*.* 49 50include $(DEP_FILE) 51