blob: 842a5c91597c92705257cc25fa74b3c4c7182264 [file] [log] [blame] [raw]
########## BEGIN LOCAL CONFIGURATIONS ##########
FACIL_INCLUDE_DIR := ../facil.io/lib/facil
FACIL_LIB_DIR := /usr/local/lib
CC := gcc-4.3.2
CFLAGS := -Wall -O1 --std gnu99 -D NODEBUG -D HAVE_ZLIB
LIBS := -l socket -l nsl
########## END LOCAL CONFIGURATIONS ##########
# Copied from facil.io source
# Set Endian Flag
ifeq ($(shell printf "int main(void) {int i = 1; return (int)(i & ((unsigned char *)&i)[sizeof(i)-1]);}\n" | $(CC) -x c -o _fio___endian_test - >> /dev/null 2> /dev/null ; ./_fio___endian_test >> /dev/null 2> /dev/null; echo $$?; rm _fio___endian_test 2> /dev/null), 1)
$(info * Detected Big Endian byte order.)
CFLAGS += -D__BIG_ENDIAN__=1
else ifeq ($(shell printf "int main(void) {int i = 1; return (int)(i & ((unsigned char *)&i)[0]);}\n" | $(CC) -xc -o _fio___endian_test - >> /dev/null 2> /dev/null ; ./_fio___endian_test >> /dev/null 2> /dev/null; echo $$?; rm _fio___endian_test 2> /dev/null), 1)
$(info * Detected Little Endian byte order.)
CFLAGS += -D__BIG_ENDIAN__=0
else
$(info * Byte ordering (endianness) detection failed)
endif
CFLAGS += -I $(FACIL_INCLUDE_DIR)
LDFLAGS += -L $(FACIL_LIB_DIR)
LIBS += -l facil
all: wscat wspppd
clean:
rm -f *.o wscat wspppd
%: %.c
$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
%: %.o
$(CC) $(LDFLAGS) $< -o $@ $(LIBS)