Makefile 1012 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
# To build with SSL under windows, do:
# wine make load_balancer.exe SSL=openssl  # OpenSSL build
# wine make load_balancer.exe SSL=krypton  # Krypton build

PROG = load_balancer
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -pthread $(CFLAGS_EXTRA)

ifeq ($(SSL), openssl)
  OPENSSL_PATH = ./openssl-0.9.8
11
  CFLAGS_EXTRA += -DMG_ENABLE_SSL -I$(OPENSSL_PATH)/include
12 13 14 15 16
	CFLAGS_EXTRA += /link /libpath:$(OPENSSL_PATH)/lib ssleay32.lib libeay32.lib
endif

ifeq ($(SSL), krypton)
	KRYPTON_PATH = ../../../krypton
17
  CFLAGS_EXTRA += -DMG_ENABLE_SSL $(KRYPTON_PATH)/krypton.c -I$(KRYPTON_PATH)
18 19 20 21 22 23 24 25
endif

all: $(PROG)

$(PROG): $(SOURCES)
	$(CC) $(SOURCES) -o $@ $(CFLAGS)

$(PROG).exe: $(SOURCES)
26
	cl $(SOURCES) /I.. /MD /Fe$@ /DMG_ENABLE_THREADS advapi32.lib $(CFLAGS_EXTRA)
27 28 29 30 31 32 33 34 35 36 37 38 39

test: $(PROG)
	$(MAKE) -C ../api_server
	sh unit_test.sh $$(pwd)/$(PROG)

docker-build:
	docker build -t cesanta/load_balancer .

docker-push:
	docker push cesanta/load_balancer

clean:
	rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)