diff --git a/Makefile b/Makefile index a0d4256..be90860 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,13 @@ # ENV -BUILD_DIR ?= build +BUILD_DIR ?= $(PWD)/build +FORGE_SRC ?= $(PWD)/forge-steel TARGET ?= forge RUN_ARGS ?= --project=$(PWD)/project -is=576 -VERSION ?= invar-$(shell grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' forge-steel/configure.ac) +VERSION ?= invar-$(shell grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' $(FORGE_SRC)/configure.ac) +SOURCES ?= $(FORGE_SRC)/src/*.h $(FORGE_SRC)/src/*.c $(FORGE_SRC)/hashmap.c/hashmap.c $(FORGE_SRC)/log.c/src/log.c +CFLAGS ?= -Ofast -Ofast -march=native -flto -funroll-loops -fprefetch-loop-arrays -fno-exceptions -fopenmp -I$(FORGE_SRC)/include -DGLFW_INCLUDE_NONE -DGLFW_NATIVE_INCLUDE_NONE -DLOG_USE_COLOR -DVERSION=\"$(VERSION)\" -DOPENGL_MAJOR_VERSION=3 -DOPENGL_MINOR_VERSION=1 +LDLIBS ?= -lm -lGL -lglfw -lasound # FILES @@ -21,22 +25,7 @@ forge-steel/include/linmath.h: $(BUILD_DIR)/$(TARGET): forge-steel/src/main.c forge-steel/hashmap.c/hashmap.c forge-steel/log.c/src/log.c forge-steel/include/linmath.h mkdir -p $(BUILD_DIR) - gcc \ - forge-steel/src/*.h forge-steel/src/*.c \ - -Iforge-steel/include \ - forge-steel/hashmap.c/hashmap.c \ - forge-steel/log.c/src/log.c \ - -lm -lGL -lglfw -lasound \ - -Wall -Wextra \ - -Wno-format-truncation \ - -DGLFW_INCLUDE_NONE \ - -DGLFW_NATIVE_INCLUDE_NONE \ - -DLOG_USE_COLOR \ - -DVERSION=\"$(VERSION)\" \ - -DOPENGL_MAJOR_VERSION=3 \ - -DOPENGL_MINOR_VERSION=1 \ - -o build/$(TARGET) \ - -O3 + $(CC) $(SOURCES) $(CFLAGS) $(LDLIBS) -o $(BUILD_DIR)/$(TARGET) # ACTIONS @@ -49,20 +38,20 @@ apt-install: sudo apt update sudo apt install -y weston kitty libglfw3-dev libgl-dev libasound2-dev libv4l-dev -.PHONY: setup-weston: +.PHONY: setup-weston setup-weston: - ln -s $(PWD)/system/weston.ini $(XDG_CONFIG_HOME)/weston.ini + ln -s $(topsrscdir)/system/weston.ini $(XDG_CONFIG_HOME)/weston.ini -.PHONY: setup-system-services: +.PHONY: setup-system-services setup-system-services: - sudo ln -s $(PWD)/system/getty@tty1.service /etc/systemd/system/getty@tty1.service + sudo ln -s $(topsrscdir)/system/getty@tty1.service /etc/systemd/system/getty@tty1.service sudo systemctl daemon-reload sudo systemctl enable getty@tty1.service -.PHONY: setup-user-services: +.PHONY: setup-user-services setup-user-services: - sudo ln -s $(PWD)/system/weston.service /etc/systemd/user/weston.service - sudo ln -s $(PWD)/system/weston.socket /etc/systemd/user/weston.socket + sudo ln -s $(topsrscdir)/system/weston.service /etc/systemd/user/weston.service + sudo ln -s $(topsrscdir)/system/weston.socket /etc/systemd/user/weston.socket systemctl --user daemon-reload systemctl --user enable weston seatd @@ -72,7 +61,7 @@ install: remove-passwd apt-install setup-weston setup-system-services setup-user .PHONY: clean clean: - rm -rf $(BUILD_DIR) + $(RM) -r $(BUILD_DIR) .PHONY: build build: $(BUILD_DIR)/$(TARGET)