1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-22 22:33:25 +01:00

Move makefile into root directory

Requested by @mannol.
This commit is contained in:
Ansa89 2015-03-21 18:33:51 +01:00
parent a64b8cae89
commit a11289de79
4 changed files with 20 additions and 14 deletions

View File

@ -36,7 +36,6 @@ You can omit `libnotify` if you intend to build without desktop notifications en
<a name="Compiling">
## Compiling
```
cd build/
make PREFIX="/where/to/install"
sudo make install PREFIX="/where/to/install"
```

View File

@ -1,4 +1,4 @@
BASE_DIR = $(shell cd .. && pwd -P)
BASE_DIR = $(shell pwd -P)
CFG_DIR = $(BASE_DIR)/cfg
-include $(CFG_DIR)/global_vars.mk
@ -49,22 +49,28 @@ endif
# Include all needed checks
-include $(CFG_DIR)/checks/check_features.mk
# Fix path for object files
OBJ := $(addprefix $(BUILD_DIR)/, $(OBJ))
# Targets
all: toxic
all: $(BUILD_DIR)/toxic
toxic: $(OBJ)
@echo " LD $@"
@$(CC) $(CFLAGS) -o toxic $(OBJ) $(LDFLAGS)
$(BUILD_DIR)/toxic: $(OBJ)
@echo " LD $(@:$(BUILD_DIR)/%=%)"
@$(CC) $(CFLAGS) -o $(BUILD_DIR)/toxic $(OBJ) $(LDFLAGS)
%.o: $(SRC_DIR)/%.c
@echo " CC $@"
@$(CC) $(CFLAGS) -o $*.o -c $(SRC_DIR)/$*.c
@$(CC) -MM $(CFLAGS) $(SRC_DIR)/$*.c > $*.d
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@if [ ! -e $(BUILD_DIR) ]; then \
mkdir -p $(BUILD_DIR) ;\
fi
@echo " CC $(@:$(BUILD_DIR)/%=%)"
@$(CC) $(CFLAGS) -o $(BUILD_DIR)/$*.o -c $(SRC_DIR)/$*.c
@$(CC) -MM $(CFLAGS) $(SRC_DIR)/$*.c > $(BUILD_DIR)/$*.d
clean:
rm -f *.d *.o toxic
rm -rf $(BUILD_DIR)
-include $(OBJ:.o=.d)
-include $(BUILD_DIR)/$(OBJ:.o=.d)
-include $(CFG_DIR)/targets/*.mk

View File

@ -8,6 +8,7 @@ else
endif
# Project directories
BUILD_DIR = $(BASE_DIR)/build
DOC_DIR = $(BASE_DIR)/doc
SRC_DIR = $(BASE_DIR)/src
SND_DIR = $(BASE_DIR)/sounds

View File

@ -1,8 +1,8 @@
# Install target
install: toxic
install: $(BUILD_DIR)/toxic
@echo "Installing toxic executable"
@mkdir -p $(abspath $(DESTDIR)/$(BINDIR))
@install -m 0755 toxic $(abspath $(DESTDIR)/$(BINDIR)/toxic)
@install -m 0755 $(BUILD_DIR)/toxic $(abspath $(DESTDIR)/$(BINDIR)/toxic)
@echo "Installing desktop file"
@mkdir -p $(abspath $(DESTDIR)/$(APPDIR))