2024-12-23 01:54:51 +01:00
|
|
|
prefix ?= /usr
|
2023-01-20 15:25:00 -08:00
|
|
|
bindir = $(prefix)/bin
|
|
|
|
|
libdir = $(prefix)/lib
|
|
|
|
|
includedir = $(prefix)/include
|
|
|
|
|
datarootdir = $(prefix)/share
|
|
|
|
|
datadir = $(datarootdir)
|
|
|
|
|
|
2024-07-14 20:28:12 +02:00
|
|
|
CARGO_TARGET_DIR ?= target
|
2023-01-20 15:25:00 -08:00
|
|
|
TARGET = debug
|
|
|
|
|
DEBUG ?= 0
|
|
|
|
|
ifeq ($(DEBUG),0)
|
|
|
|
|
TARGET = release
|
|
|
|
|
ARGS += --release
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
VENDOR ?= 0
|
|
|
|
|
ifneq ($(VENDOR),0)
|
|
|
|
|
ARGS += --frozen
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
BIN = cosmic-workspaces
|
2023-03-31 19:04:45 -07:00
|
|
|
APPID = com.system76.CosmicWorkspaces
|
2023-01-20 15:25:00 -08:00
|
|
|
|
|
|
|
|
all: $(BIN)
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
rm -rf target
|
|
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
|
rm -rf .cargo vendor vendor.tar
|
|
|
|
|
|
|
|
|
|
$(BIN): Cargo.toml Cargo.lock src/main.rs vendor-check
|
|
|
|
|
cargo build $(ARGS) --bin ${BIN}
|
|
|
|
|
|
|
|
|
|
install:
|
2024-07-14 20:28:12 +02:00
|
|
|
install -Dm0755 $(CARGO_TARGET_DIR)/$(TARGET)/$(BIN) $(DESTDIR)$(bindir)/$(BIN)
|
2023-03-31 19:04:45 -07:00
|
|
|
install -Dm0644 data/$(APPID).desktop $(DESTDIR)$(datadir)/applications/$(APPID).desktop
|
2024-02-28 13:49:35 -05:00
|
|
|
install -Dm0644 data/$(APPID).svg $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/$(APPID).svg
|
|
|
|
|
|
2023-01-20 15:25:00 -08:00
|
|
|
|
|
|
|
|
## Cargo Vendoring
|
|
|
|
|
|
|
|
|
|
vendor:
|
|
|
|
|
rm .cargo -rf
|
|
|
|
|
mkdir -p .cargo
|
|
|
|
|
cargo vendor | head -n -1 > .cargo/config
|
|
|
|
|
echo 'directory = "vendor"' >> .cargo/config
|
|
|
|
|
tar cf vendor.tar vendor
|
|
|
|
|
rm -rf vendor
|
|
|
|
|
|
|
|
|
|
vendor-check:
|
|
|
|
|
ifeq ($(VENDOR),1)
|
|
|
|
|
rm vendor -rf && tar xf vendor.tar
|
|
|
|
|
endif
|