2009-12-05 09:22:43 +00:00
|
|
|
CC=gcc
|
|
|
|
OBJ=obj
|
|
|
|
OBJNAME?=libenet.a
|
|
|
|
PRETTY_OUTPUT?=1
|
|
|
|
EROOT?=build
|
|
|
|
RELEASE?=1
|
|
|
|
OPTLEVEL?=2
|
|
|
|
SRC=src
|
2010-06-22 21:50:01 +00:00
|
|
|
INC=include
|
2009-12-05 09:22:43 +00:00
|
|
|
|
|
|
|
include ../../$(EROOT)/Makefile.shared
|
|
|
|
|
|
|
|
ifneq (0,$(RELEASE))
|
2010-08-17 20:00:44 +00:00
|
|
|
# Debugging disabled
|
2009-12-05 09:22:43 +00:00
|
|
|
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL)
|
|
|
|
else
|
2010-08-17 20:00:44 +00:00
|
|
|
# Debugging enabled
|
2009-12-05 09:22:43 +00:00
|
|
|
debug=-ggdb -O0 -DDEBUGGINGAIDS
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq (0,$(DEBUGANYWAY))
|
|
|
|
debug+=-ggdb
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
|
2010-08-17 20:00:44 +00:00
|
|
|
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
|
|
|
|
$(F_JUMP_TABLES) $(F_NO_STACK_PROTECTOR)
|
2009-12-05 09:22:43 +00:00
|
|
|
|
2010-06-22 21:50:01 +00:00
|
|
|
CPPFLAGS=-I$(INC) -I$(SRC)
|
2009-12-05 09:22:43 +00:00
|
|
|
|
|
|
|
OBJECTS=$(OBJ)/callbacks.o \
|
|
|
|
$(OBJ)/host.o \
|
|
|
|
$(OBJ)/list.o \
|
|
|
|
$(OBJ)/packet.o \
|
|
|
|
$(OBJ)/peer.o \
|
2010-06-22 21:50:01 +00:00
|
|
|
$(OBJ)/protocol.o \
|
|
|
|
$(OBJ)/compress.o
|
2009-12-05 09:22:43 +00:00
|
|
|
|
|
|
|
ifeq ($(PLATFORM),WINDOWS)
|
|
|
|
OBJECTS+= $(OBJ)/win32.o
|
|
|
|
OBJNAME=libenet_win32.a
|
|
|
|
OBJ=obj_win
|
|
|
|
else
|
|
|
|
OBJECTS+= $(OBJ)/unix.o
|
|
|
|
endif
|
|
|
|
|
|
|
|
# OBJECTS=$(SOURCES:%.c=$(OBJ)/%.o)
|
|
|
|
|
|
|
|
$(OBJNAME): $(OBJECTS)
|
|
|
|
$(AR) cr $@ $^
|
|
|
|
|
2010-06-22 21:50:01 +00:00
|
|
|
$(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c $(INC)/enet/*.h
|
2009-12-05 09:22:43 +00:00
|
|
|
-mkdir -p $(OBJ)
|
|
|
|
$(COMPILE_STATUS)
|
|
|
|
if $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
|
2010-08-17 20:00:44 +00:00
|
|
|
|
2009-12-05 09:22:43 +00:00
|
|
|
ifeq ($(PRETTY_OUTPUT),1)
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
-rm -f $(OBJECTS) $(OBJNAME)
|