Newer
Older
###########################################################################
# Fadecandy Server
src/main.cpp \
src/opcsink.cpp \
src/libusbev.cpp \
src/usbdevice.cpp \
src/fcdevice.cpp \
src/enttecdmxdevice.cpp \
src/fcserver.cpp
CLEAN_FILES += src/*.d src/*.o
CPPFLAGS += -Wno-tautological-constant-out-of-range-compare -Wno-strict-aliasing
###########################################################################
# System Support
UNAME := $(shell uname)
MINGW := $(findstring MINGW32, $(UNAME))
LIBS += -lstdc++ -lm
ifeq ($(UNAME), Darwin)
# Mac OS X (32-bit build)
LDFLAGS += -m32
CPPFLAGS += -m32
endif
ifneq ("$(MINGW)", "")
# Windows
TARGET := $(TARGET).exe
endif
ifneq ("$(DEBUG)", "")
# Debug build
TARGET := debug-$(TARGET)
CPPFLAGS += -g -DDEBUG
else
# Optimized build
POSTBUILD_CMD := strip $(TARGET)
CPPFLAGS += -Os -DNDEBUG
LDFLAGS += -Os
endif
###########################################################################
# Built-in libev
C_FILES += libev/ev.c
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
CFLAGS += -DEV_STANDALONE -Wno-comment -Wno-unused-variable \
-Wno-extern-initializer -Wno-unused-value -Wno-bitwise-op-parentheses
INCLUDES += -Ilibev
CLEAN_FILES += libev/*.d libev/*.o
###########################################################################
# Built-in rapidjson
INCLUDES += -I.
###########################################################################
# Built-in libusbx
C_FILES += \
libusbx/libusb/core.c \
libusbx/libusb/descriptor.c \
libusbx/libusb/hotplug.c \
libusbx/libusb/io.c \
libusbx/libusb/strerror.c \
libusbx/libusb/sync.c
ifeq ($(UNAME), Darwin)
# Mac OS X
C_FILES += \
libusbx/libusb/os/darwin_usb.c \
libusbx/libusb/os/poll_posix.c \
libusbx/libusb/os/threads_posix.c
LIBS += -framework CoreFoundation -framework IOKit -lobjc
CFLAGS += -DOS_DARWIN -DTHREADS_POSIX -DPOLL_NFDS_TYPE=nfds_t \
-DLIBUSB_CALL= -DDEFAULT_VISIBILITY= -DHAVE_GETTIMEOFDAY
endif
ifneq ("$(MINGW)", "")
# Windows
CPPFLAGS += -DOS_WINDOWS
endif
INCLUDES += -Ilibusbx/libusb
CLEAN_FILES += libusbx/libusb/*.d libusbx/libusb/*.o
###########################################################################
# Build Rules
# Compiler options for C and C++
CPPFLAGS += -MMD $(INCLUDES)
# Compiler options for C++ only
CXXFLAGS += -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
OBJS := $(CPP_FILES:.cpp=.o) $(C_FILES:.c=.o)
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(POSTBUILD_CMD)
-include $(OBJS:.o=.d)
clean: