Files
astros/makefile

44 lines
816 B
Makefile

CC=gcc
C_FLAGS=-Wall -Wextra -pedantic -Wno-unknown-pragmas -g -DDEBUG -DSUS_TARGET_VERSION=10000
DIR_SRC=src
DIR_INC=include
DIR_BUILD=build
DEPS=dl pthread m atomic rt sus
OUTBIN=$(DIR_BUILD)/bin/main
SRCS=$(shell find $(DIR_SRC) -type f -name '*.c')
OBJS=$(patsubst $(DIR_SRC)/%.c,$(DIR_BUILD)/obj/%.o,$(SRCS))
DEPS_EXT=$(patsubst %,-l%,$(DEPS))
.PHONY: all build rebuild loc clean run
# Compatibility
.WAIT: # No dependencies
# No code
all: $(OUTBIN)
build: $(OUTBIN)
rebuild: clean .WAIT build
run: $(OUTBIN)
sudo ./$(OUTBIN)
$(OUTBIN): $(OBJS)
@mkdir -p $(@D)
$(CC) $(OBJS) $(DEPS_EXT) -o $@
$(DIR_BUILD)/obj/%.o: $(DIR_SRC)/%.c
@mkdir -p $(@D)
$(CC) $(C_FLAGS) -I$(DIR_INC) -c $< -o $@
loc:
@scc -s lines --no-cocomo --no-gitignore -w --size-unit binary src
clean:
@$(RM) -r $(DIR_BUILD)