quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

Makefile.dj (3581B)


      1 #
      2 # c-ares Makefile for djgpp/gcc/Watt-32.
      3 # Copyright (C) Gisle Vanem <gvanem@yahoo.no>
      4 # SPDX-License-Identifier: MIT
      5 #
      6 include src/lib/Makefile.inc
      7 
      8 OBJ_DIR = djgpp
      9 OBJECTS = $(addprefix $(OBJ_DIR)/, \
     10             $(CSOURCES:.c=.o))
     11 
     12 CSRC = $(addprefix src/lib/, $(CSOURCES))
     13 #CSRC := $(filter-out src/lib/windows_port.c, $(CSOURCES))
     14 
     15 OBJ_SUBDIRS = $(OBJ_DIR)/dsa $(OBJ_DIR)/event $(OBJ_DIR)/legacy $(OBJ_DIR)/record $(OBJ_DIR)/str $(OBJ_DIR)/util
     16 
     17 VPATH = src/lib src/tools
     18 
     19 #
     20 # Root directory for Waterloo tcp/ip.
     21 # WATT_ROOT should be set during Watt-32 install.
     22 #
     23 WATT32_ROOT = $(realpath $(WATT_ROOT))
     24 WATT32_LIB  = $(WATT32_ROOT)/lib/libwatt.a
     25 
     26 CFLAGS = -g -O2 -I./include -I./src/lib -I./src/lib/include \
     27          -I$(WATT32_ROOT)/inc \
     28          -Wall \
     29          -Wextra \
     30          -Waggregate-return \
     31          -Wcast-align \
     32          -Wcast-qual \
     33          -Wconversion \
     34          -Wdeclaration-after-statement \
     35          -Wdouble-promotion \
     36          -Wfloat-equal \
     37          -Winit-self \
     38          -Wjump-misses-init \
     39          -Wlogical-op \
     40          -Wmissing-braces \
     41          -Wmissing-declarations \
     42          -Wmissing-format-attribute \
     43          -Wmissing-include-dirs \
     44          -Wmissing-prototypes \
     45          -Wnested-externs \
     46          -Wno-coverage-mismatch \
     47          -Wold-style-definition \
     48          -Wpacked \
     49          -Wpointer-arith \
     50          -Wshadow \
     51          -Wsign-conversion \
     52          -Wstrict-overflow \
     53          -Wstrict-prototypes \
     54          -Wtrampolines \
     55          -Wundef \
     56          -Wunreachable-code \
     57          -Wunused \
     58          -Wvariadic-macros \
     59          -Wvla \
     60          -Wwrite-strings \
     61          -Werror=implicit-int \
     62          -Werror=implicit-function-declaration \
     63          -Wno-long-long \
     64          -DWATT32 -DHAVE_CONFIG_H   \
     65          -D_REENTRANT \
     66          -DCARES_NO_DEPRECATED \
     67          -Dselect=select_s
     68 
     69 # Can't enable -Wredundant-decls due to WATT32 issues
     70 
     71 
     72 LDFLAGS = -s
     73 
     74 ifeq ($(OS),Windows_NT)
     75   #
     76   # Windows hosted djgpp cross compiler. Get it from:
     77   #   https://github.com/andrewwutw/build-djgpp/releases
     78   #
     79   DJ_PREFIX ?= c:/some-path/djgpp/bin/i586-pc-msdosdjgpp-
     80   CC = $(DJ_PREFIX)gcc
     81 
     82 else
     83   #
     84   # The normal djgpp 'gcc' for MSDOS.
     85   #
     86   CC = gcc
     87 endif
     88 
     89 GENERATED = src/lib/ares_config.h \
     90             include/ares_build.h
     91 
     92 TARGETS = libcares.a adig.exe ahost.exe
     93 
     94 .SECONDARY: $(OBJ_DIR)/ares_getopt.o
     95 
     96 all: $(OBJ_DIR) $(OBJ_SUBDIRS) $(GENERATED) $(TARGETS)
     97 	@echo Welcome to c-ares.
     98 
     99 libcares.a: $(OBJECTS)
    100 	ar rs $@ $(OBJECTS)
    101 
    102 src/lib/ares_config.h: src/lib/config-dos.h
    103 	cp --update $< $@
    104 
    105 include/ares_build.h: include/ares_build.h.dist
    106 	cp --update $< $@
    107 
    108 %.exe: src/tools/%.c $(OBJ_DIR)/ares_getopt.o libcares.a
    109 	$(call compile_and_link, $@, $^ $(WATT32_LIB))
    110 
    111 # Clean generated files and objects.
    112 #
    113 clean:
    114 	- rm -f depend.dj $(GENERATED) $(OBJ_DIR)/*.o
    115 	- rmdir $(OBJ_SUBDIRS)
    116 
    117 # Clean everything
    118 #
    119 realclean vclean: clean
    120 	- rm -f $(TARGETS) $(TARGETS:.exe=.map)
    121 
    122 .PHONY: obj_subdirs $(OBJ_SUBDIRS)
    123 
    124 obj_subdirs: $(OBJ_SUBDIRS)
    125 
    126 $(OBJ_SUBDIRS):
    127 	mkdir $@
    128 
    129 $(OBJ_DIR)/%.o: %.c
    130 	$(CC) $(CFLAGS) -o $@ -c $<
    131 	@echo
    132 
    133 define compile_and_link
    134   $(CC) -o $(1) $(CFLAGS) $(LDFLAGS) -Wl,--print-map,--sort-common $(2) > $(1:.exe=.map)
    135   @echo
    136 endef
    137 
    138 DEP_REPLACE = sed -e 's@\(.*\)\.o: @\n$$(OBJ_DIR)\/\1.o: @' \
    139                   -e 's@$(WATT32_ROOT)@$$(WATT32_ROOT)@g'
    140 
    141 #
    142 # One may have to do 'make -f Makefile.dj clean' first in case
    143 # a foreign 'curl_config.h' is making trouble.
    144 #
    145 depend: $(GENERATED) Makefile.dj
    146 	$(CC) -MM $(CFLAGS) $(CSRC) | $(DEP_REPLACE) > depend.dj
    147 
    148 -include depend.dj
    149