-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
69 lines (56 loc) · 1.84 KB
/
Makefile
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
#!/bin/bash
# Makefile for MLP
CC = g++
DEBUG = -g3
PROJNAME = mlp
HEADERPATH = ./src
SOURCEPATH = ./src
LOCALDEPSINCLUDES = ./deps
AUXINCLUDES =
AUXLIBS =
INCLUDES = -I$(LOCALDEPSINCLUDES) -I$(AUXINCLUDES)
LIBS = -L$(AUXLIBS)
#LIBS += -L/usr/local/lib/
#rlunaro: removed optimization for tests: -O3
CFLAGS = -std=gnu++11 -std=c++11 -Wall -fmessage-length=0 -fPIC $(INCLUDES)
CFLAGS += $(DEBUG)
LFLAGS = $(LIBS)
#For verbosity
LFLAGS += -v
LDFLAGS = -shared
HDRS = $(shell find $(HEADERPATH) $(AUXINCLUDES) $(LOCALDEPSINCLUDES) -name '*.h')
HDRS += $(shell find $(HEADERPATH) $(AUXINCLUDES) $(LOCALDEPSINCLUDES) -name '*.h++')
SRCS = $(shell find $(SOURCEPATH) -name '*.cpp')
SRCS += $(shell find $(SOURCEPATH) -name '*.c')
OBJS = $(SRCS:.cpp=.o)
TXTS = $(wildcard *.txt)
SCRIPTS = $(wildcard *.sh)
all : IrisDatasetTest MLPTest LayerTest NodeTest $(PROJNAME).a $(PROJNAME).so
$(PROJNAME).a : $(SOURCEPATH)/MLP.o
@echo Creating static lib $@
ar rcs $@ $(SOURCEPATH)/MLP.o
$(PROJNAME).so : $(SOURCEPATH)/MLP.o
@echo Creating dynamic lib $@
$(CC) -o $@ $(SOURCEPATH)/MLP.o $(LDFLAGS) $(LFLAGS)
%.o: %.cpp $(HDRS)
$(CC) -c $(CFLAGS) $(LFLAGS) -o $@ $<
IrisDatasetTest: $(SOURCEPATH)/IrisDatasetTest.o $(SOURCEPATH)/MLP.o
@echo Compiling program $@
$(CC) $^ $(CFLAGS) $(LFLAGS) -o $@
MLPTest: $(SOURCEPATH)/MLPTest.o $(SOURCEPATH)/MLP.o
@echo Compiling program $@
$(CC) $^ $(CFLAGS) $(LFLAGS) -o $@
LayerTest: $(SOURCEPATH)/LayerTest.o $(SOURCEPATH)/MLP.o
@echo Compiling program $@
$(CC) $^ $(CFLAGS) $(LFLAGS) -o $@
NodeTest: $(SOURCEPATH)/NodeTest.o $(SOURCEPATH)/MLP.o
@echo Compiling program $@
$(CC) $^ $(CFLAGS) $(LFLAGS) -o $@
clean:
@echo Clean
rm -f *~ $(SOURCEPATH)/*.o *~
@echo Success
cleanall:
@echo Clean All
rm -f *~ $(SOURCEPATH)/*.o *~ $(PROJNAME).a $(PROJNAME).so IrisDatasetTest MLPTest LayerTest NodeTest
@echo Success