Makefile 1.13 KB
PROJECT = xmlrpc
INCLUDE = include
CFLAGS  = -Wall -ggdb

###
# PROJECT CONFIG
#
SUBDIRS = system server reader

system_OBJ       = daemonize.o handleCmdLine.o logRotate.o monitor.o \
				   signalHandling.o socket.o
server_OBJ       = serverInit.o serverRun.o serverShutdown.o
commonReader_OBJ = clientClose.o clientRead.o writeBuffer.o
httpReader_OBJ   = httpRequest.o

VPATH=$(INCLUDE)

export CFLAGS INCLUDE \
	system_OBJ server_OBJ commonReader_OBJ httpReader_OBJ

OBJECTS=$(PROJECT).o \
		$(addprefix system/,$(system_OBJ)) \
		$(addprefix server/,$(server_OBJ)) \
		$(addprefix reader/commonReader/,$(commonReader_OBJ)) \
		$(addprefix reader/httpReader/,$(httpReader_OBJ))

###
# EXPLICIT RULES
#
$(PROJECT): $(PROJECT).o subdirs
	gcc $(CFLAGS) -o $(PROJECT) -lexpat $(OBJECTS)

$(PROJECT).o: server.h monitor.h signalHandling.h daemonize.h appConfig.h

###
# IMPLICIT RULES
#
%.o: %.c
	gcc $(CFLAGS) -c $< -o $@

doc:
	doxygen

###
# PHONYS
#
.PHONY: clean subdirs subdirs_clean $(SUBDIRS)

subdirs: $(SUBDIRS)

$(SUBDIRS):
	$(MAKE) -C $@

subdirs_clean:
	for dir in $(SUBDIRS); do \
		$(MAKE) -C $$dir clean; \
	done

clean: subdirs_clean
	-rm *.o