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.
shuffle3/Makefile

46 lines
947 B

4 years ago
SRC = $(wildcard src/*.c)
INCLUDE = include/
5 years ago
4 years ago
PROJECT=shuffle3
5 years ago
4 years ago
BUILD=build
5 years ago
4 years ago
CFLAGS+= $(addprefix -I,$(INCLUDE)) -Wall -pedantic --std=gnu11
LDFLAGS+= -lm
RELEASE_CFLAGS?= -O3 -march=native -flto -fgraphite
RELEASE_LDFLAGS?= -O3 -flto
DEBUG_CFLAGS?= -g -O0
DEBUG_LDFLAGS?= -O0
OBJ = $(addprefix obj/,$(SRC:.c=.o))
.PHONY: release
release: | dirs $(BUILD)/$(PROJECT)-release
.PHONY: debug
debug: | dirs $(BUILD)/$(PROJECT)-debug
5 years ago
4 years ago
dirs:
@mkdir -p obj/src
@mkdir -p $(BUILD)
obj/%.o: %.c
$(CC) -c $< $(CFLAGS) -o $@ $(LDFLAGS)
$(BUILD)/$(PROJECT)-release: CFLAGS+= $(RELEASE_CFLAGS)
$(BUILD)/$(PROJECT)-release: LDFLAGS+= $(RELEASE_LDFLAGS)
$(BUILD)/$(PROJECT)-release: $(OBJ)
$(CC) $^ $(CFLAGS) -o $@ $(LDFLAGS)
strip $@
$(BUILD)/$(PROJECT)-debug: CFLAGS+= $(DEBUG_CFLAGS)
$(BUILD)/$(PROJECT)-debug: LDFLAGS+= $(DEBUG_LDFLAGS)
$(BUILD)/$(PROJECT)-debug: $(OBJ)
$(CC) $^ $(CFLAGS) -o $@ $(LDFLAGS)
clean:
rm -rf obj
rm -f $(BUILD)/*