kakoune

Fork of kakoune, an acceptable text editor
git clone git://git.laack.co/kakoune.git
Log | Files | Refs

Tupfile (1812B)


      1 ##
      2 ## Tupfile for kakoune
      3 ## by lenormf
      4 ##
      5 ## How to use:
      6 ## Initialize a tup database in the main directory with `tup init`
      7 ## Create a symlink from `contrib/Tupfile` to `src/Tupfile`
      8 ## Start the build with the `tup` command
      9 ##
     10 
     11 .gitignore
     12 
     13 debug    = yes
     14 static   = no
     15 
     16 CXX      = g++
     17 CXXFLAGS = -pedantic -std=c++17 -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-address
     18 CPPFLAGS =
     19 LDFLAGS  =
     20 LIBS     =
     21 
     22 ifeq ($(debug),yes)
     23     CPPFLAGS += -DKAK_DEBUG
     24     CXXFLAGS += -g
     25     suffix = .debug
     26 else
     27     ifeq ($(debug),no)
     28         CXXFLAGS += -O3
     29         suffix = .opt
     30     else
     31         error debug should be either yes or no
     32     endif
     33 endif
     34 
     35 ifeq ($(static),yes)
     36     PKG_CONFIG_FLAGS += --static
     37     LDFLAGS += -static -pthread
     38 endif
     39 
     40 ifneq (@(TUP_PLATFORM),macosx)
     41     ifeq (@(TUP_PLATFORM),win32)
     42         LIBS += -lncursesw -ldbghelp
     43         CPPFLAGS += -D_XOPEN_SOURCE=700
     44     else
     45         LDFLAGS += -rdynamic
     46     endif
     47 endif
     48 
     49 ifeq ($(CXX),clang++)
     50     CXXFLAGS += -frelaxed-template-template-args
     51 endif
     52 ifeq ($(CXX),g++)
     53     CXXFLAGS += -Wno-init-list-lifetime
     54 endif
     55 
     56 !cxx = |> ^ CC %f^ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF %O.d -c %f -o %o |>
     57 !ld = |> ^ LD %o^ $(CXX) $(LDFLAGS) %f $(LIBS) -o %o |>
     58 !ln = |> ^ LN %o^ ln -sf %f %o |>
     59 
     60 : foreach *.cc |> !cxx |> .%B$(suffix).o | .%B$(suffix).d {objs}
     61 : |> ^ MK %o^ printf "%%s" "namespace Kakoune { const char* version = \"`if [ -f .version ]; then cat .version; elif  [ -d ../.git ]; then git describe --tags HEAD; else echo \"unknown\"; fi`\"; }" > .version.cc.tmp; if cmp -s .version.cc.tmp .version.cc; then rm .version.cc.tmp; else mv .version.cc.tmp .version.cc; fi |> .version.cc
     62 : .version.cc |> ^ CC %f^ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c %f -o %o |> %B.o
     63 : {objs} .version.o |> !ld |> kak$(suffix)
     64 : kak$(suffix) |> !ln |> kak