44 lines
992 B
Makefile
44 lines
992 B
Makefile
MAGIC_CFLAGS=-DHAVE_MAGIC
|
|
MAGIC_LIBS=-lmagic
|
|
|
|
CC=gcc
|
|
CFLAGS+=-Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=20120607L -D_FILE_OFFSET_BITS=64 $(MAGIC_CFLAGS)
|
|
LIBS=-lmicrohttpd $(MAGIC_LIBS)
|
|
|
|
TARGET=fileshare
|
|
SOURCE=main.c logger.c dirlisting.c util.c
|
|
DEPS=logger.h templates.h dirlisting.h util.h
|
|
|
|
OBJ=$(patsubst %.c, %.o, $(SOURCE))
|
|
|
|
all: debug
|
|
|
|
debug: CFLAGS+=-O0 -ggdb -DDEBUG
|
|
debug: show_cflags $(TARGET)
|
|
@echo '>>>' DEBUG build complete.
|
|
|
|
release: CFLAGS+=-O3
|
|
release: show_cflags $(TARGET)
|
|
@echo '>>>' RELEASE build complete.
|
|
|
|
.PHONY show_cflags:
|
|
@echo --- Build parameters: ------------------------------------------
|
|
@echo CFLAGS\=$(CFLAGS)
|
|
@echo LIBS\=$(LIBS)
|
|
@echo -----------------------------------------------------------------
|
|
|
|
$(TARGET): $(OBJ) $(DEPS) Makefile
|
|
@echo Linking...
|
|
@$(CC) -o $(TARGET) $(OBJ) $(LIBS)
|
|
|
|
%.o: %.c $(DEPS) Makefile
|
|
@echo Compiling $< ...
|
|
@$(CC) -c $(CFLAGS) -o $@ $< $(INCLUDES)
|
|
|
|
doc:
|
|
doxygen doxygen.conf
|
|
|
|
clean:
|
|
rm -f $(TARGET)
|
|
rm -f $(OBJ)
|