1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
TP-Link_Archer-XR500v/EN7526G_3.18Kernel_SDK/apps/public/traceroute-2.0.17/Make.rules
2024-07-22 01:58:46 -03:00

207 lines
4.0 KiB
Plaintext
Executable File

#
# Copyright (c) 2000, 2001, 2007 Dmitry Butskoy
# <buc@citadel.stu.neva.ru>
# License: GPL v2 or any later
#
# See COPYING for the status of this software.
#
#
# Common rule and variable definitions.
# This file should be included by main and by per-target Makefiles.
#
ifndef srcdir
$(error srcdir variable not defined)
endif
MAKE = make --no-print-directory -r
# Use env=yes on cmdline to inherit environment values
ifeq ($(env),yes)
define set
$(eval ifneq ($$(origin $(1)),environment)
$(1) = $(2)
else
override MAKE := $(1)="$($(strip $(1)))" $(MAKE)
endif)
endef
else
set = $(eval $(1) = $(2))
endif
#$(call set, CROSS,mips-linux-)
#$(call set, CC, $$(CROSS)gcc)
#$(call set, AS, $$(CROSS)as)
#$(call set, LD, $$(CROSS)ld)
$(call set, DEPEND, $$(CROSS)gcc -MM -MG)
#$(call set, AR, $$(CROSS)ar)
$(call set, RANLIB, $$(CROSS)ranlib)
$(call set, INSTALL, cp)
$(call set, INDENT, true)
gcc = $(findstring gcc,$(CC))
$(call set, CFLAGS, $(if $(gcc), -O2 -Wall, -O))
$(call set, CPPFLAGS, )
$(call set, LDFLAGS, -s)
$(call set, LIBS, )
ifneq ($(TC_CFLAGS), )
CFLAGS+=$(TC_CFLAGS)
endif
# install stuff
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
sbindir = $(exec_prefix)/sbin
libdir = $(exec_prefix)/lib
libexecdir = $(exec_prefix)/libexec/$(NAME)
sysconfdir = $(prefix)/etc
includedir = $(prefix)/include
datadir = $(prefix)/share
mandir = $(datadir)/man
infodir = $(datadir)/info
localstatedir = $(prefix)/var
sharedstatedir = $(prefix)/com
DESTDIR =
# layout stuff
SKIPDIRS = tmp%
SKIPDIRS += CVS%
INCLUDEDIRS = include%
LIBDIRS = lib%
MODDIRS = mod%
SKIPINSTALL = test%
include $(srcdir)/Make.defines
ifndef NAME
NAME = $(notdir $(srcdir))
endif
ifndef subdirs
ifeq ($(TARGET),.MAIN)
# for better performance...
subdirs := $(patsubst %/,%,$(wildcard */))
else
subdirs := $(patsubst $(srcdir)/%/,%,$(filter %/,$(wildcard $(srcdir)/*/)))
endif
subdirs := $(filter-out $(SKIPDIRS), $(subdirs))
endif
install install-%: subdirs := $(filter-out $(SKIPINSTALL), $(subdirs))
override MAKE += srcdir=$(srcdir) subdirs="$(subdirs)" shared=$(shared)
INCLUDEDIRS := $(filter $(INCLUDEDIRS), $(subdirs))
LIBDIRS := $(filter $(LIBDIRS), $(subdirs))
MODDIRS := $(filter $(MODDIRS), $(subdirs))
EXEDIRS := $(filter-out $(INCLUDEDIRS) $(LIBDIRS) $(MODDIRS), $(subdirs))
MODUSERS := $(filter $(MODUSERS), $(subdirs))
SBINUSERS := $(filter $(SBINUSERS), $(subdirs))
LIBDIRS := $(filter-out $(LIBLAST),$(LIBDIRS)) $(filter $(LIBDIRS),$(LIBLAST))
includes = $(foreach dir, $(INCLUDEDIRS) $(LIBDIRS), $(srcdir)/$(dir))
libraries = $(foreach dir, $(filter lib%,$(LIBDIRS)), $(srcdir)/$(dir))
vpath lib%.so $(libraries)
vpath lib%.a $(libraries)
_libs = $(strip $(foreach lib,$(LIBDIRS),\
$(if $(filter lib%,$(lib)),\
$(patsubst lib%,-l%,$(lib)),\
$(wildcard $(srcdir)/$(lib)/$(lib).so \
$(srcdir)/$(lib)/$(lib).a))))
LIBRARIES += -L ../libsupp -lsupp
#override LIBS := $(_libs) -lm $(LIBS)
override LIBS := $(LIBRARIES) -lm $(LIBS)
ifneq ($(gcc),)
CPATH = $(subst $(empty) ,:,$(includes))
LIBRARY_PATH = $(subst $(empty) ,:,$(libraries))
export CPATH LIBRARY_PATH
else
override CPPFLAGS += $(patsubst %,-I%,$(includes))
override LIBS += $(patsubst %,-L%,$(libraries))
endif
LIBDEPS = $(filter-out -L%,$(LIBS))
#
# SUBDIRS STUFF
#
ifneq ($(TARGET),.MAIN)
obj := o
ifeq ($(shared),yes)
ifneq ($(PIC),no)
ifeq ($(filter $(TARGET),$(LIBDIRS) $(MODDIRS) .MODULE),$(TARGET))
obj := lo
endif
endif
endif
sources = $(wildcard *.c)
OBJS = $(sources:.c=.$(obj))
.PHONY: dummy all depend install clean force
dummy: all
clean:
rm -f *.o *.a *.lo *.so $(TARGET) core a.out
ifneq ($(sources),)
depend: $(sources)
$(DEPEND) $(CFLAGS) $(CPPFLAGS) $^ >.depend
else
depend:
@true
endif
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c $*.c
%.lo: %.c
$(CC) -fPIC $(CFLAGS) $(CPPFLAGS) -o $*.lo -c $*.c
%.o: %.s
$(AS) -o $*.o $*.s
%.o: %.S
$(CC) -traditional $(CPPFLAGS) -c $*.S
# include if it is present only...
ifeq (.depend, $(wildcard .depend))
include .depend
endif
endif
#
# ...end of SUBDIRS STUFF
#