Project

General

Profile

Statistics
| Revision:

root / branches / colonetmk2 / code / projects / swarm / Makefile @ 1456

History | View | Annotate | Download (1.85 KB)

1 1456 rcahoon
# ColonetServer makefile
2
3
COLONYROOT = ../../..
4
5
CC = g++
6
CFLAGS = -Wall -Wshadow -Wextra -g
7
8
CPPFILES = main.c colonet_wireless.cpp
9
CPPOBJECTS = $(CPPFILES:.cpp=.o)
10
11
HEADERFILES = includes/*.h
12
13
INCLUDE_DIRS = $(COLONYROOT)/code/projects/libwireless/lib includes
14
LIBRARY_DIRS = $(COLONYROOT)/code/projects/libwireless/lib
15
16
#this takes the include directory and puts a -I in front of each directory name before being used in a gcc statement
17
INCLUDE_DIRS_FOR_GCC = $(patsubst %, -I %, $(INCLUDE_DIRS))
18
#this takes the library directory and puts a -L in front of each directory name so it can be used in a gcc statement
19
LIBRARY_DIRS_FOR_GCC = $(patsubst %,-L%, $(LIBRARY_DIRS))
20
21
.PHONY : all clean run
22
23
all: SwarmServer
24
25
run:
26
	cd ../../libwireless/lib; make colonet
27
	make; ./SwarmServer
28
29
$(COLONYROOT)/code/projects/libwireless/lib/libwireless_colonet.a: $(COLONYROOT)/code/projects/libwireless/lib/*.c $(COLONYROOT)/code/projects/libwireless/lib/*.h
30
	@echo "---------------------------"
31
	@echo "---compiling wireless library code---"
32
	cd $(COLONYROOT)/code/projects/libwireless/lib; make colonet
33
	@echo "---finish compiling wireless library code---"
34
	@echo "----------------------------------"
35
36
SwarmServer: $(COLONYROOT)/code/projects/libwireless/lib/libwireless_colonet.a $(COLONETCPPFILES) $(COLONETFILES) $(LOGGINGFILES) $(COLONETHEADERFILES) $(VISIONOBJECTS)
37
	@echo "-----------------------"
38
	@echo "---begin compiling server---"
39
	@echo ""
40
	@echo "-----creating object files-----"
41
	$(CC) $(CFLAGS) -c $(CPPFILES) $(INCLUDE_DIRS_FOR_GCC)
42
	@echo "-----finish creating object files-----"
43
	@echo ""
44
	@echo "-----linking files-----"
45
	$(CC) $(CFLAGS) $(CPPOBJECTS) $(LIBRARY_DIRS_FOR_GCC) -lpthread -lwireless_colonet $(INCLUDE_DIRS_FOR_GCC) -o $@
46
	@echo "-----finish linking files-----"
47
	@echo ""
48
	@echo "---finish compilation---"
49
	@echo "-----------------------"
50
51
clean:
52
	rm -rf *.o SwarmServer *~