1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-16 05:33:02 +01:00
toxic/Makefile

85 lines
2.4 KiB
Makefile
Raw Normal View History

BASE_DIR = $(shell pwd -P)
CFG_DIR = $(BASE_DIR)/cfg
2014-06-25 09:13:57 +02:00
2014-08-25 12:54:44 +02:00
-include $(CFG_DIR)/global_vars.mk
LIBS = libtoxcore ncursesw libconfig libqrencode
CFLAGS = -std=gnu99 -pthread -Wall -g -fstack-protector-all
2014-09-24 20:23:08 +02:00
CFLAGS += '-DTOXICVER="$(VERSION)"' -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED -D_FILE_OFFSET_BITS=64
CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"'
CFLAGS += $(USER_CFLAGS)
LDFLAGS = $(USER_LDFLAGS)
OBJ = autocomplete.o avatars.o bootstrap.o chat.o chat_commands.o configdir.o curl_util.o execute.o
OBJ += file_transfers.o friendlist.o global_commands.o group_commands.o groupchat.o help.o input.o
OBJ += line_info.o log.o message_queue.o misc_tools.o name_lookup.o notify.o prompt.o qr_code.o settings.o
OBJ += term_mplex.o toxic.o toxic_strings.o windows.o
# Check on wich system we are running
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S), Linux)
2015-03-16 13:16:03 +01:00
-include $(CFG_DIR)/systems/Linux.mk
endif
2014-07-06 21:23:58 +02:00
ifeq ($(UNAME_S), FreeBSD)
2015-03-16 13:16:03 +01:00
-include $(CFG_DIR)/systems/FreeBSD.mk
2014-07-06 21:23:58 +02:00
endif
2015-09-09 13:23:48 +02:00
ifeq ($(UNAME_S), DragonFly)
-include $(CFG_DIR)/systems/FreeBSD.mk
endif
2015-03-15 20:27:00 +01:00
ifeq ($(UNAME_S), OpenBSD)
-include $(CFG_DIR)/systems/FreeBSD.mk
endif
ifeq ($(UNAME_S), Darwin)
2015-03-16 13:16:03 +01:00
-include $(CFG_DIR)/systems/Darwin.mk
endif
ifeq ($(UNAME_S), Solaris)
2015-03-16 13:16:03 +01:00
-include $(CFG_DIR)/systems/Solaris.mk
endif
# Check on which platform we are running
UNAME_M = $(shell uname -m)
ifeq ($(UNAME_M), x86_64)
2015-03-16 13:16:03 +01:00
-include $(CFG_DIR)/platforms/x86_64.mk
endif
ifneq ($(filter %86, $(UNAME_M)),)
2015-03-16 13:16:03 +01:00
-include $(CFG_DIR)/platforms/x86.mk
endif
ifneq ($(filter arm%, $(UNAME_M)),)
2015-03-16 13:16:03 +01:00
-include $(CFG_DIR)/platforms/arm.mk
2014-07-22 09:59:44 +02:00
endif
# Include all needed checks
-include $(CFG_DIR)/checks/check_features.mk
# Fix path for object files
OBJ := $(addprefix $(BUILD_DIR)/, $(OBJ))
# Targets
all: $(BUILD_DIR)/toxic
$(BUILD_DIR)/toxic: $(OBJ)
@echo " LD $(@:$(BUILD_DIR)/%=%)"
@$(CC) $(CFLAGS) -o $(BUILD_DIR)/toxic $(OBJ) $(LDFLAGS)
2015-08-20 13:39:47 +02:00
$(BUILD_DIR)/osx_video.o: $(SRC_DIR)/$(OSX_VIDEO)
@echo " CC $(@:$(BUILD_DIR)/)osx_video.o"
@$(CC) $(CFLAGS) -o $(BUILD_DIR)/osx_video.o -c $(SRC_DIR)/$(OSX_VIDEO)
$(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 $(BUILD_DIR)/*.d $(BUILD_DIR)/*.o $(BUILD_DIR)/toxic
-include $(BUILD_DIR)/$(OBJ:.o=.d)
2014-06-23 21:55:32 +02:00
-include $(CFG_DIR)/targets/*.mk
2014-08-25 12:54:44 +02:00
.PHONY: clean all