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
|
# This Makefile was tested with GNU Make
CC=gcc
LCM_GEN=../../lcmgen/lcm-gen
# Use pkg-config to lookup the proper compiler and linker flags for LCM
CFLAGS=`pkg-config --cflags lcm` -I../gtest/include -std=c99 -g
CXXFLAGS=`pkg-config --cflags lcm` -I../gtest/include -g
LDFLAGS=`pkg-config --libs lcm`
GTEST_LIBS=../gtest/libgtest.a ../gtest/libgtest_main.a
types1:=exampleconst_t primitives_t primitives_list_t multidim_array_t node_t comments_t
types2:=another_type_t cross_package_t
types_obj:=$(types1:%=lcmtest_%.o) $(types2:%=lcmtest2_%.o)
types_src:=$(types1:%=lcmtest_%.c) $(types1:%=lcmtest_%.h) $(types2:%=lcmtest2_%.c) $(types2:%=lcmtest2_%.h)
all: server \
client \
memq_test \
eventlog_test \
udpm_test
server: server.o common.o $(types_obj)
echo $(types_obj)
$(CC) -o $@ $^ $(LDFLAGS)
client: client.o common.o $(types_obj)
$(CXX) -o $@ $^ $(LDFLAGS) $(GTEST_LIBS)
common.o: common.c $(types_src)
$(CC) $(CFLAGS) -c $<
client.o: client.cpp $(types_src)
$(CXX) $(CXXFLAGS) -c $<
server.o: server.c $(types_src)
$(CC) $(CFLAGS) -c $<
eventlog_test: eventlog_test.o common.o
$(CXX) -o $@ $^ $(LDFLAGS) $(GTEST_LIBS)
eventlog_test.o: eventlog_test.cpp
$(CXX) $(CXXFLAGS) -c $<
memq_test: memq_test.o
$(CXX) -o $@ $^ $(LDFLAGS) $(GTEST_LIBS)
memq_test.o: memq_test.cpp $(types_src)
$(CXX) $(CXXFLAGS) -c $<
udpm_test: udpm_test.o
$(CXX) -o $@ $^ $(LDFLAGS) $(GTEST_LIBS)
udpm_test.o: udpm_test.cpp $(types_src)
$(CXX) $(CXXFLAGS) -c $<
lcmtest_%.o: lcmtest_%.c lcmtest_%.h
$(CC) $(CFLAGS) -c $<
lcmtest_%.c lcmtest_%.h: ../types/lcmtest/%.lcm
$(LCM_GEN) -c $<
lcmtest2_%.c lcmtest2_%.h: ../types/lcmtest2/%.lcm
$(LCM_GEN) -c $<
clean:
rm -f client server
rm -f memq_test eventlog_test
rm -f $(types_src)
rm -f *.o
|