easters

easters.dev solutions (C)
git clone git://bsandro.tech/easters
Log | Files | Refs | LICENSE

Makefile (693B)


      1 .SUFFIXES:
      2 MAKEFLAGS+=-rR
      3 
      4 UNAME:=$(shell uname -m)
      5 OS:=$(shell uname -s)
      6 
      7 ifeq ($(origin CC),default)
      8 CC=cc
      9 endif
     10 
     11 CFLAGS=-std=c99 -Wall -Wextra -I.
     12 ifeq ($(DEBUG),1)
     13 CFLAGS+=-O0 -g
     14 else
     15 CFLAGS+=-O3 -ffast-math
     16 LTO=-flto
     17 endif
     18 
     19 ifeq ($(OS),NetBSD)
     20 CFLAGS+=-I/usr/pkg/include
     21 endif
     22 
     23 ifeq ($(UNAME),i386)
     24 CFLAGS+=-mtune=native
     25 else
     26 CFLAGS+=-march=native $(LTO)
     27 endif
     28 
     29 LDFLAGS=-lc -lm
     30 
     31 ifeq ($(OS),NetBSD)
     32 LDFLAGS+=-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
     33 endif
     34 
     35 .PHONY: clean
     36 
     37 %+run: %.bin
     38 	./$< < inputs/$*.txt
     39 
     40 %+test: %.bin
     41 	./$< < inputs/$*_test.txt
     42 
     43 %+test1: %.bin
     44 	./$< < inputs/$*_test1.txt
     45 
     46 .SECONDARY:
     47 %: %.bin
     48 	@:
     49 
     50 %.bin: %.c
     51 	${CC} $< $(CFLAGS) $(LDFLAGS) -o $@
     52 
     53 clean:
     54 	rm -f ./*.bin