C and C++ web framework. http://rapida.vilor.one/docs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

98 lines
3.7 KiB

include config.mk
CXXSRC := $(shell find cxx -type f -name '*.cxx')
CSRC += $(shell find c -type f -name '*.c')
ifeq ($(FCGI_SERVER), 1)
CSRC += servers/fcgi.c
endif
CXXOBJ := $(CXXSRC:.cxx=.o)
COBJ := $(CSRC:.c=.o)
#target C and C++ libraries
all: librapida.a librapida.so librapidaxx.a librapidaxx.so
#target Distribution
dist: all
mkdir -p rapida-$(VERSION)/lib
cp -rf README.md COPYING include rapida-$(VERSION)
mv librapida.so librapida.so.$(VERSION)
mv librapidaxx.so librapidaxx.so.$(VERSION)
cp -f *.a *.so* rapida-$(VERSION)/lib
tar cf rapida-$(VERSION).tar rapida-$(VERSION)
gzip rapida-$(VERSION).tar
rm -rf rapida-$(VERSION)
install: all
mv librapida.so librapida.so.$(VERSION)
mv librapidaxx.so librapidaxx.so.$(VERSION)
install librapida.a $(PREFIX)/lib
install librapidaxx.a $(PREFIX)/lib
install librapida.so.$(VERSION) $(PREFIX)/lib
install librapidaxx.so.$(VERSION) $(PREFIX)/lib
ln -s $(PREFIX)/lib/librapida.so.$(VERSION) $(PREFIX)/lib/librapida.so
ln -s $(PREFIX)/lib/librapidaxx.so.$(VERSION) $(PREFIX)/lib/librapidaxx.so
mkdir -p $(PREFIX)/include/rapida
cp -f include/* $(PREFIX)/include/rapida
uninstall:
rm -f $(PREFIX)/lib/librapida.a
rm -f $(PREFIX)/lib/librapidaxx.a
rm -f $(PREFIX)/lib/librapida.so*
rm -f $(PREFIX)/lib/librapidaxx.so*
rm -rf $(PREFIX)/include/rapida
#target Examples
examples: all
cd $@ && make
#target Shared C library
librapida.so: $(COBJ)
$(CC) -shared $^ -o $@ $(LDFLAGS)
#target Shared C++ library
librapidaxx.so: $(COBJ) $(CXXOBJ)
$(CXX) -shared $^ -o $@ $(LDFLAGS)
#target Static C library
librapida.a: $(COBJ)
ar rvs $@ $^
#target Static C++ library
librapidaxx.a: $(COBJ) $(CXXOBJ)
ar rvs $@ $^
c/%.o: c/%.c
$(CC) $(CFLAGS) -fPIC $< -c -o $@
cxx/%.o: cxx/%.cxx
$(CXX) $(CXXFLAGS) $(CXXSTD) -fPIC $< -c -o $@
#target Tests runner
run_tests: tests/*.cxx librapidaxx.a
$(CXX) $(CXXFLAGS) -std=c++17 `pkg-config --cflags catch2` $^ -o $@ $(LDFLAGS)
#target Clear project from generated files
clean:
rm -f **/*.o *.a *.so* run_tests
#target Clear project from generated and distribution files
distclean: clean
rm -f *.tar*
#target Generate documentation
docs:
cd $@ && VERSION=$(VERSION) doxygen
#target Format code
format:
clang-format -Werror -i **/*.c* **/*.h*
#target Show this help
help:
@echo "$$(tput bold)Usage:$$(tput sgr0)\nmake <target> [flags...] [args...]\n"
@echo "$$(tput bold)Targets:$$(tput sgr0)";echo;sed -ne"/^#target /{h;s/.*//;:d" -e"H;n;s/^#target //;td" -e"s/:.*//;G;s/\\n#target /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|awk -F --- -v n=$$(tput cols) -v i=29 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'
@echo "\n$$(tput bold)Flags (All values other than '0' are true):$$(tput sgr0)";echo;sed -ne"/^#flag /{h;s/.*//;:d" -e"H;n;s/^#flag //;td" -e"s/:.*//;G;s/\\n#flag /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|awk -F --- -v n=$$(tput cols) -v i=29 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'
@echo "\n$$(tput bold)Arguments:$$(tput sgr0)";echo;sed -ne"/^#arg /{h;s/.*//;:d" -e"H;n;s/^#arg //;td" -e"s/:.*//;G;s/\\n#arg /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|awk -F --- -v n=$$(tput cols) -v i=29 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'
.PHONY: help clean distclean docs format