Makes typing faster. I hope.
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.

69 lines
1.7 KiB

CFLAGS = -std=c99 -Werror -Wall -Wpedantic
CFLAGS += -D_XOPEN_SOURCE=700
ifndef DISABLE_SSE
CFLAGS += -msse -msse2 -msse3
endif
#-D_GNU_SOURCE
#HEADERS = inc/parasol.h
ifdef DEBUG
CFLAGS += -Og
CFLAGS += -ggdb3
CFLAGS += -Db_sanitize=address
else
CFLAGS += -O3
CFLAGS += -flto
endif
ifdef CC
CC = @(TARGET)@(CC)
else
CC = gcc
endif
ifdef PKGCONFIG_DIR
PKGCONFIG = PKG_CONFIG_PATH=@(PKGCONFIG_DIR) PKG_CONFIG_LIBDIR=@(PKGCONFIG_DIR) pkg-config
else
PKGCONFIG = @(TARGET)pkg-config
endif
# Compilation binary dependencies - If the binary changes, we rebuild
# Normally tup needs suid to do this. This is an attempt to do this without that.
: |> ^ cksum cc ^ cksum `which $(CC)` > %o |> tup/cc.sum
: |> ^ cksum ar ^ cksum `which @(TARGET)ar` > %o |> tup/ar.sum
: |> ^ cksum ld ^ cksum `which @(TARGET)ld` > %o |> tup/ld.sum
: |> ^ cksum pkg-config ^ cksum `which $(PKGCONFIG)` > %o |> tup/pkg-config.sum
ifndef LD
LDFLAGS += -fuse-ld=gold -fuse-linker-plugin -fno-fat-lto-objects
else
LDFLAGS += @(LD)
endif
#CFLAGS += -Iinc
#CFLAGS += `$(PKGCONFIG) --cflags libuv`
ifndef SHAREDLIBS
LDFLAGS += -static
endif
#LDFLAGS += `@(TARGET)pkg-config --libs libuv`
# Macros
!cc-obj = | <header> tup/cc.sum |> ^ CC %f^ $(CC) $(CFLAGS) -c %f -o %o |>
!cc-bin = | <header> tup/cc.sum |> ^ CC %f^ $(CC) $(CFLAGS) %f -o %o $(LDFLAGS) |>
!ar = | tup/ar.sum |> ^ AR %f^ @(TARGET)ar rcs %o %f |>
#:foreach src/*.c |> !cc-obj |> obj/%B.o
:src/kbd.c |> !cc-bin |> bin/kbd
#:foreach src/dict/*.c |> !cc-obj |> obj/dict/%B.o
:src/dict.c |> !cc-bin |> bin/dict
#:foreach src/examples/*.c |> !cc-bin |> bin/%B
#Copy over the include file to any variants
#:foreach inc/*.h |> !tup_preserve |> inc/%b | <header>