# If building for posix: ifeq ($(PLATFORM),arm-freertos) CC ?= arm-none-eabi-gcc AR ?= arm-none-eabi-ar PORT_SOURCES = src/port/httpd-freertos.c else # Probably posix CC ?= cc AR ?= ar PORT_SOURCES = src/port/httpd-posix.c endif # additional C flags can be specified via the CFLAGS variable LIB_FILE = libspritehttpd.a LIB_SOURCES = ${PORT_SOURCES} \ lib/espfs/espfs.c \ lib/heatshrink/heatshrink_decoder.c \ src/utils/base64.c \ src/utils/sha1.c \ src/httpd.c \ src/httpd-auth.c \ src/httpd-utils.c \ src/httpd-loop.c \ src/cgi-espfs.c \ src/cgi-redirects.c \ src/cgi-websocket.c LIB_OBJS = $(LIB_SOURCES:.c=.o) LIB_INCLUDES = -Iinclude -Ilib/heatshrink -Ilib/espfs LIB_CFLAGS = -fPIC -Wall -Wextra -c -Os -ggdb -std=gnu99 -DGIT_HASH='"$(shell git rev-parse --short HEAD)"' all: $(LIB_FILE) %.o: %.c $(CC) -c $(LIB_INCLUDES) $(CFLAGS) $(LIB_CFLAGS) -o $@ $< $(LIB_FILE): $(LIB_OBJS) $(AR) rcs $@ $^ clean: find . -type f -name '*.o' -delete find . -type f -name '*.d' -delete find . -type f -name '*.a' -delete find . -type f -name '*.elf' -delete