2021-10-29 18:04:24 +02:00
|
|
|
#
|
|
|
|
# c-ares Makefile for djgpp/gcc/Watt-32.
|
2023-10-08 02:24:18 +02:00
|
|
|
# Copyright (C) Gisle Vanem <gvanem@yahoo.no>
|
|
|
|
# SPDX-License-Identifier: MIT
|
2021-10-29 18:04:24 +02:00
|
|
|
#
|
|
|
|
include src/lib/Makefile.inc
|
|
|
|
|
2024-08-11 18:07:05 +02:00
|
|
|
OBJ_DIR = djgpp
|
|
|
|
OBJECTS = $(addprefix $(OBJ_DIR)/, \
|
|
|
|
$(CSOURCES:.c=.o))
|
|
|
|
|
|
|
|
CSRC = $(addprefix src/lib/, $(CSOURCES))
|
|
|
|
#CSRC := $(filter-out src/lib/windows_port.c, $(CSOURCES))
|
|
|
|
|
|
|
|
OBJ_SUBDIRS = $(OBJ_DIR)/dsa $(OBJ_DIR)/event $(OBJ_DIR)/legacy $(OBJ_DIR)/record $(OBJ_DIR)/str $(OBJ_DIR)/util
|
2021-10-29 18:04:24 +02:00
|
|
|
|
|
|
|
VPATH = src/lib src/tools
|
|
|
|
|
|
|
|
#
|
|
|
|
# Root directory for Waterloo tcp/ip.
|
|
|
|
# WATT_ROOT should be set during Watt-32 install.
|
|
|
|
#
|
|
|
|
WATT32_ROOT = $(realpath $(WATT_ROOT))
|
|
|
|
WATT32_LIB = $(WATT32_ROOT)/lib/libwatt.a
|
|
|
|
|
2024-10-15 02:45:37 +02:00
|
|
|
CFLAGS = -g -O2 -I./include -I./src/lib -I./src/lib/include \
|
2024-07-06 15:23:58 +02:00
|
|
|
-I$(WATT32_ROOT)/inc \
|
|
|
|
-Wall \
|
|
|
|
-Wextra \
|
|
|
|
-Waggregate-return \
|
|
|
|
-Wcast-align \
|
|
|
|
-Wcast-qual \
|
|
|
|
-Wconversion \
|
|
|
|
-Wdeclaration-after-statement \
|
|
|
|
-Wdouble-promotion \
|
|
|
|
-Wfloat-equal \
|
|
|
|
-Winit-self \
|
|
|
|
-Wjump-misses-init \
|
|
|
|
-Wlogical-op \
|
|
|
|
-Wmissing-braces \
|
|
|
|
-Wmissing-declarations \
|
|
|
|
-Wmissing-format-attribute \
|
|
|
|
-Wmissing-include-dirs \
|
|
|
|
-Wmissing-prototypes \
|
|
|
|
-Wnested-externs \
|
|
|
|
-Wno-coverage-mismatch \
|
|
|
|
-Wold-style-definition \
|
|
|
|
-Wpacked \
|
|
|
|
-Wpointer-arith \
|
|
|
|
-Wshadow \
|
|
|
|
-Wsign-conversion \
|
|
|
|
-Wstrict-overflow \
|
|
|
|
-Wstrict-prototypes \
|
|
|
|
-Wtrampolines \
|
|
|
|
-Wundef \
|
|
|
|
-Wunreachable-code \
|
|
|
|
-Wunused \
|
|
|
|
-Wvariadic-macros \
|
|
|
|
-Wvla \
|
|
|
|
-Wwrite-strings \
|
|
|
|
-Werror=implicit-int \
|
|
|
|
-Werror=implicit-function-declaration \
|
|
|
|
-Wno-long-long \
|
2021-10-29 18:04:24 +02:00
|
|
|
-DWATT32 -DHAVE_CONFIG_H \
|
2024-07-06 15:23:58 +02:00
|
|
|
-D_REENTRANT \
|
|
|
|
-DCARES_NO_DEPRECATED \
|
2021-10-29 18:04:24 +02:00
|
|
|
-Dselect=select_s
|
|
|
|
|
2024-07-06 15:23:58 +02:00
|
|
|
# Can't enable -Wredundant-decls due to WATT32 issues
|
|
|
|
|
|
|
|
|
2021-10-29 18:04:24 +02:00
|
|
|
LDFLAGS = -s
|
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
#
|
|
|
|
# Windows hosted djgpp cross compiler. Get it from:
|
|
|
|
# https://github.com/andrewwutw/build-djgpp/releases
|
|
|
|
#
|
|
|
|
DJ_PREFIX ?= c:/some-path/djgpp/bin/i586-pc-msdosdjgpp-
|
|
|
|
CC = $(DJ_PREFIX)gcc
|
|
|
|
|
|
|
|
else
|
|
|
|
#
|
|
|
|
# The normal djgpp 'gcc' for MSDOS.
|
|
|
|
#
|
|
|
|
CC = gcc
|
|
|
|
endif
|
|
|
|
|
|
|
|
GENERATED = src/lib/ares_config.h \
|
|
|
|
include/ares_build.h
|
|
|
|
|
2023-10-08 02:24:18 +02:00
|
|
|
TARGETS = libcares.a adig.exe ahost.exe
|
2021-10-29 18:04:24 +02:00
|
|
|
|
|
|
|
.SECONDARY: $(OBJ_DIR)/ares_getopt.o
|
|
|
|
|
2024-08-11 18:07:05 +02:00
|
|
|
all: $(OBJ_DIR) $(OBJ_SUBDIRS) $(GENERATED) $(TARGETS)
|
2021-10-29 18:04:24 +02:00
|
|
|
@echo Welcome to c-ares.
|
|
|
|
|
|
|
|
libcares.a: $(OBJECTS)
|
|
|
|
ar rs $@ $(OBJECTS)
|
|
|
|
|
|
|
|
src/lib/ares_config.h: src/lib/config-dos.h
|
|
|
|
cp --update $< $@
|
|
|
|
|
|
|
|
include/ares_build.h: include/ares_build.h.dist
|
|
|
|
cp --update $< $@
|
|
|
|
|
|
|
|
%.exe: src/tools/%.c $(OBJ_DIR)/ares_getopt.o libcares.a
|
|
|
|
$(call compile_and_link, $@, $^ $(WATT32_LIB))
|
|
|
|
|
|
|
|
# Clean generated files and objects.
|
|
|
|
#
|
|
|
|
clean:
|
|
|
|
- rm -f depend.dj $(GENERATED) $(OBJ_DIR)/*.o
|
2024-08-11 18:07:05 +02:00
|
|
|
- rmdir $(OBJ_SUBDIRS)
|
2021-10-29 18:04:24 +02:00
|
|
|
|
|
|
|
# Clean everything
|
|
|
|
#
|
|
|
|
realclean vclean: clean
|
|
|
|
- rm -f $(TARGETS) $(TARGETS:.exe=.map)
|
|
|
|
|
2024-08-11 18:07:05 +02:00
|
|
|
.PHONY: obj_subdirs $(OBJ_SUBDIRS)
|
|
|
|
|
|
|
|
obj_subdirs: $(OBJ_SUBDIRS)
|
|
|
|
|
|
|
|
$(OBJ_SUBDIRS):
|
|
|
|
mkdir $@
|
2021-10-29 18:04:24 +02:00
|
|
|
|
|
|
|
$(OBJ_DIR)/%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
@echo
|
|
|
|
|
|
|
|
define compile_and_link
|
|
|
|
$(CC) -o $(1) $(CFLAGS) $(LDFLAGS) -Wl,--print-map,--sort-common $(2) > $(1:.exe=.map)
|
|
|
|
@echo
|
|
|
|
endef
|
|
|
|
|
|
|
|
DEP_REPLACE = sed -e 's@\(.*\)\.o: @\n$$(OBJ_DIR)\/\1.o: @' \
|
|
|
|
-e 's@$(WATT32_ROOT)@$$(WATT32_ROOT)@g'
|
|
|
|
|
|
|
|
#
|
|
|
|
# One may have to do 'make -f Makefile.dj clean' first in case
|
|
|
|
# a foreign 'curl_config.h' is making trouble.
|
|
|
|
#
|
|
|
|
depend: $(GENERATED) Makefile.dj
|
2024-08-11 18:07:05 +02:00
|
|
|
$(CC) -MM $(CFLAGS) $(CSRC) | $(DEP_REPLACE) > depend.dj
|
2021-10-29 18:04:24 +02:00
|
|
|
|
|
|
|
-include depend.dj
|
|
|
|
|