blob: de76d0e18d7219cf072e6bbc23e412335aeabed9 (
plain) (
blame)
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
88
|
#
# makefile for ctprof_srv
#
# examples:
# make clean debug CC=your-favorite-gcc DESTDIR=your-destination-dir install
# make clean release CC=your-favorite-gcc DESTDIR=your-destination-dir install
# To Use CROSS_COMPILE:
# make clean debug arm DESTDIR=your-destination-dir install
# make clean release arm DESTDIR=your-destination-dir install
# make arm all DESTDIR=your-destination-dir
ifeq ($(findstring arm, $(MAKECMDGOALS)), arm)
CC= $(CROSS_COMPILE)gcc
endif
ifeq ($(findstring test, $(MAKECMDGOALS)), test)
TEST = -D TEST_MODE
else
TEST =
endif
ifeq ($(findstring debug, $(MAKECMDGOALS)), debug)
CFLAGS= -std=c99 -c -g -Wall $(INC_PATH) -D DEBUG -D SERVER -D TCI6614 -D _GNU_SOURCE $(TEST)
OBJDIR= ./debug
else
CFLAGS= -std=c99 -c -O2 $(INC_PATH) -D SERVER -D TCI6614 -D _GNU_SOURCE
OBJDIR= ./release
endif
COMMON = ../common
LFLAGS =
LIBS=
LIB_PATH=
INCLUDE_PATH = -I $(COMMON) -I ../server
INCLUDE_FILES = ctoolsprof.h error.h error_handler.h logging.h socket.h command_handler.h remote_commands.h signal_handler.h etb_handler.h
VPATH = $(COMMON)
.PHONY: clean debug release install arm
all: clean release arm install
#
# Declare.c and .h dependencies
#
ctoolsprof_srv.o: ctoolsprof_srv_main.c $(INCLUDE_FILES)
socket.o: socket.c $(INCLUDE_FILES)
error_handler.o : error_handler.c $(INCLUDE_FILES)
logging.o : logging.c $(INCLUDE_FILES)
error.o : error.c $(INCLUDE_FILES)
command_handler.o : command_handler.c $(INCLUDE_FILES)
remote_commands.o : remote_commands.c $(INCLUDE_FILES)
signal_handler.o : signal_handler.c $(INCLUDE_FILES)
etb_handler.o : etb_handler.c $(INCLUDE_FILES)
TIETB.o : TIETB.c ETBAddr.h ETBInterface.h
#
# Add objects
#
OBJECTS = $(addprefix $(OBJDIR)/, ctoolsprof_srv_main.o socket.o error_handler.o logging.o error.o command_handler.o remote_commands.o signal_handler.o etb_handler.o TIETB.o)
$(OBJDIR)/%.o: %.c
@echo "Compiling" $<
@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) $(INCLUDE_PATH) -o $@ $<
ctprof_srv: $(OBJECTS)
@echo "Building target" $@
$(CC) $(LFLAGS) $(LIBS_PATH) -o $(OBJDIR)/$@ $(OBJECTS) $(LIBS)
debug: ctprof_srv
@echo "debug build complete"
release: ctprof_srv
@echo "release build complete"
arm: ctprof_srv
@echo "ARM version built"
test: ctprof_srv
@echo "Test version built - ETB file simulation"
install:
mv $(OBJDIR)/ctprof_srv $(DESTDIR)
clean:
-rm $(OBJECTS)
|