kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

Makefile (1197B)



      1 # kodev Makefile
      2 
      3 CC?=cc
      4 PREFIX?=/usr/local
      5 OBJDIR?=obj
      6 KODEV=kodev
      7 DESTDIR?=
      8 INSTALL_DIR=$(PREFIX)/bin
      9 
     10 S_SRC=	../src/cli.c
     11 
     12 CFLAGS+=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
     13 CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
     14 CFLAGS+=-Wsign-compare -Iincludes -std=c99 -pedantic
     15 CFLAGS+=-DPREFIX='"$(PREFIX)"'
     16 LDFLAGS=-lcrypto
     17 
     18 ifneq ("$(NOOPT)", "")
     19 	CFLAGS+=-O0
     20 else
     21 	CFLAGS+=-O2
     22 endif
     23 
     24 ifneq ("$(MINIMAL)", "")
     25 	CFLAGS+=-DKODEV_MINIMAL
     26 	LDFLAGS=
     27 endif
     28 
     29 OSNAME=$(shell uname -s | sed -e 's/[-_].*//g' | tr A-Z a-z)
     30 ifeq ("$(OSNAME)", "darwin")
     31 	CFLAGS+=$(shell pkg-config openssl --cflags)
     32 	LDFLAGS+=$(shell pkg-config openssl --libs)
     33 else ifeq ("$(OSNAME)", "linux")
     34 	CFLAGS+=-D_GNU_SOURCE=1
     35 endif
     36 
     37 S_OBJS=	$(S_SRC:../src/%.c=$(OBJDIR)/%.o)
     38 
     39 $(KODEV): $(OBJDIR) $(S_OBJS)
     40 	$(CC) $(S_OBJS) $(LDFLAGS) -o $(KODEV)
     41 
     42 $(OBJDIR):
     43 	@mkdir -p $(OBJDIR)
     44 
     45 install: $(KODEV)
     46 	mkdir -p $(DESTDIR)$(INSTALL_DIR)
     47 	install -m 555 $(KODEV) $(DESTDIR)$(INSTALL_DIR)/$(KODEV)
     48 
     49 uninstall:
     50 	rm -f $(DESTDIR)$(INSTALL_DIR)/$(KODEV)
     51 
     52 $(OBJDIR)/%.o: ../src/%.c
     53 	$(CC) $(CFLAGS) -c $< -o $@
     54 
     55 clean:
     56 	find . -type f -name \*.o -exec rm {} \;
     57 	rm -rf $(KODEV) $(OBJDIR)
     58 
     59 .PHONY: all clean