sw-battle-test-c

Interesting test task in C instead of C++
git clone git://bsandro.tech/sw-battle-test-c
Log | Files | Refs | README

Makefile (794B)


      1 NAME=$(shell basename ${PWD})
      2 #SDL_CFLAGS=$(shell pkg-config --cflags sdl2 SDL2_image)
      3 #SDL_LDFLAGS=$(shell pkg-config --libs sdl2 SDL2_image)
      4 SRC:=$(shell find . -type f -iname '*.c')
      5 DEPS:=$(shell find . -type f -iname '*.h')
      6 OBJ:=$(SRC:.c=.o)
      7 CFLAGS=-std=gnu11 -Wpedantic -Wall -Wextra -Wno-unused -ffast-math -I. #$(SDL_CFLAGS)
      8 ifeq (${DEBUG},1)
      9 CFLAGS+=-O0 -g
     10 else
     11 CFLAGS+=-O3 -mtune=native -march=native
     12 endif
     13 LDFLAGS=-lc -lm -flto #$(SDL_LDFLAGS)
     14 #CC=gcc
     15 
     16 all: $(NAME)
     17 
     18 .PHONY: clean gen_commands
     19 
     20 gen_commands: gen_components
     21 	./commands/gen_registry.sh > ./commands/_registry.h
     22 
     23 gen_components:
     24 	./components/populate.sh
     25 
     26 clean:
     27 	rm -f $(OBJ) $(NAME)
     28 
     29 %.o : %.c $(DEPS)
     30 	$(CC) $(CFLAGS) -c $< -o $@
     31 
     32 $(NAME): gen_commands $(OBJ)
     33 	$(CC) $(OBJ) -o $@ $(LDFLAGS)
     34 
     35 run: $(NAME)
     36 	./$(NAME)