"Fossies" - the Fresh Open Source Software Archive

Member "stress-ng-0.13.05/Makefile" (11 Oct 2021, 11635 Bytes) of package /linux/privat/stress-ng-0.13.05.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Makefile": 0.13.04_vs_0.13.05.

    1 #
    2 # Copyright (C) 2013-2021 Canonical, Ltd.
    3 #
    4 # This program is free software; you can redistribute it and/or
    5 # modify it under the terms of the GNU General Public License
    6 # as published by the Free Software Foundation; either version 2
    7 # of the License, or (at your option) any later version.
    8 #
    9 # This program is distributed in the hope that it will be useful,
   10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12 # GNU General Public License for more details.
   13 #
   14 # You should have received a copy of the GNU General Public License
   15 # along with this program; if not, write to the Free Software
   16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
   17 #
   18 
   19 VERSION=0.13.05
   20 #
   21 # Codename "wakeboarding interstellar wombat"
   22 #
   23 
   24 CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"' -O2 -std=gnu99
   25 
   26 #
   27 # Pedantic flags
   28 #
   29 ifeq ($(PEDANTIC),1)
   30 CFLAGS += -Wcast-qual -Wfloat-equal -Wmissing-declarations \
   31 	-Wmissing-format-attribute -Wno-long-long -Wpacked \
   32 	-Wredundant-decls -Wshadow -Wno-missing-field-initializers \
   33 	-Wno-missing-braces -Wno-sign-compare -Wno-multichar
   34 endif
   35 
   36 #
   37 # Verbosity
   38 #
   39 override undefine V
   40 ifeq ($(VERBOSE),)
   41 V=@
   42 Q=@
   43 else
   44 V=
   45 Q=@#
   46 endif
   47 
   48 GREP = grep
   49 #
   50 # SunOS requires special grep for -e support
   51 #
   52 KERNEL=$(shell uname -s)
   53 NODENAME=$(shell uname -n)
   54 ifeq ($(KERNEL),SunOS)
   55 ifneq ($(NODENAME),dilos)
   56 GREP = /usr/xpg4/bin/grep
   57 endif
   58 endif
   59 
   60 #
   61 # Static flags, only to be used when using GCC
   62 #
   63 ifeq ($(STATIC),1)
   64 LDFLAGS += -static -z muldefs
   65 CFLAGS += -DBUILD_STATIC
   66 endif
   67 
   68 BINDIR=/usr/bin
   69 MANDIR=/usr/share/man/man1
   70 JOBDIR=/usr/share/stress-ng/example-jobs
   71 BASHDIR=/usr/share/bash-completion/completions
   72 
   73 #
   74 #  Stressors
   75 #
   76 STRESS_SRC = \
   77 	stress-access.c \
   78 	stress-affinity.c \
   79 	stress-af-alg.c \
   80 	stress-aio.c \
   81 	stress-aio-linux.c \
   82 	stress-alarm.c \
   83 	stress-apparmor.c \
   84 	stress-atomic.c \
   85 	stress-bad-altstack.c \
   86 	stress-bad-ioctl.c \
   87 	stress-bigheap.c \
   88 	stress-bind-mount.c \
   89 	stress-binderfs.c \
   90 	stress-branch.c \
   91 	stress-brk.c \
   92 	stress-bsearch.c \
   93 	stress-cache.c \
   94 	stress-cap.c \
   95 	stress-chattr.c \
   96 	stress-chdir.c \
   97 	stress-chmod.c \
   98 	stress-chown.c \
   99 	stress-chroot.c \
  100 	stress-clock.c \
  101 	stress-clone.c \
  102 	stress-close.c \
  103 	stress-context.c \
  104 	stress-copy-file.c \
  105 	stress-cpu.c \
  106 	stress-cpu-online.c \
  107 	stress-crypt.c \
  108 	stress-cyclic.c \
  109 	stress-daemon.c \
  110 	stress-dccp.c \
  111 	stress-dentry.c \
  112 	stress-dev.c \
  113 	stress-dev-shm.c \
  114 	stress-dir.c \
  115 	stress-dirdeep.c \
  116 	stress-dirmany.c \
  117 	stress-dnotify.c \
  118 	stress-dup.c \
  119 	stress-dynlib.c \
  120 	stress-efivar.c \
  121 	stress-enosys.c \
  122 	stress-env.c \
  123 	stress-epoll.c \
  124 	stress-eventfd.c \
  125 	stress-exec.c \
  126 	stress-exit-group.c \
  127 	stress-fallocate.c \
  128 	stress-fanotify.c \
  129 	stress-fault.c \
  130 	stress-fcntl.c \
  131 	stress-file-ioctl.c \
  132 	stress-fiemap.c \
  133 	stress-fifo.c \
  134 	stress-filename.c \
  135 	stress-flock.c \
  136 	stress-fork.c \
  137 	stress-fp-error.c \
  138 	stress-fpunch.c \
  139 	stress-fstat.c \
  140 	stress-full.c \
  141 	stress-funccall.c \
  142 	stress-funcret.c \
  143 	stress-futex.c \
  144 	stress-get.c \
  145 	stress-getrandom.c \
  146 	stress-getdent.c \
  147 	stress-handle.c \
  148 	stress-hdd.c \
  149 	stress-heapsort.c \
  150 	stress-hrtimers.c \
  151 	stress-hsearch.c \
  152 	stress-icache.c \
  153 	stress-icmp-flood.c \
  154 	stress-idle-page.c \
  155 	stress-inode-flags.c \
  156 	stress-inotify.c \
  157 	stress-iomix.c \
  158 	stress-ioport.c \
  159 	stress-ioprio.c \
  160 	stress-iosync.c \
  161 	stress-io-uring.c \
  162 	stress-ipsec-mb.c \
  163 	stress-itimer.c \
  164 	stress-judy.c \
  165 	stress-kcmp.c \
  166 	stress-key.c \
  167 	stress-kill.c \
  168 	stress-klog.c \
  169 	stress-l1cache.c \
  170 	stress-landlock.c \
  171 	stress-lease.c \
  172 	stress-link.c \
  173 	stress-list.c \
  174 	stress-loadavg.c \
  175 	stress-lockbus.c \
  176 	stress-locka.c \
  177 	stress-lockf.c \
  178 	stress-lockofd.c \
  179 	stress-longjmp.c \
  180 	stress-loop.c \
  181 	stress-lsearch.c \
  182 	stress-madvise.c \
  183 	stress-malloc.c \
  184 	stress-matrix.c \
  185 	stress-matrix-3d.c \
  186 	stress-mcontend.c \
  187 	stress-membarrier.c \
  188 	stress-memcpy.c \
  189 	stress-memfd.c \
  190 	stress-memhotplug.c \
  191 	stress-memrate.c \
  192 	stress-memthrash.c \
  193 	stress-mergesort.c \
  194 	stress-mincore.c \
  195 	stress-misaligned.c \
  196 	stress-mknod.c \
  197 	stress-mlock.c \
  198 	stress-mlockmany.c \
  199 	stress-mmap.c \
  200 	stress-mmapaddr.c \
  201 	stress-mmapfixed.c \
  202 	stress-mmapfork.c \
  203 	stress-mmaphuge.c \
  204 	stress-mmapmany.c \
  205 	stress-mq.c \
  206 	stress-mremap.c \
  207 	stress-msg.c \
  208 	stress-msync.c \
  209 	stress-munmap.c \
  210 	stress-nanosleep.c \
  211 	stress-netdev.c \
  212 	stress-netlink-proc.c \
  213 	stress-netlink-task.c \
  214 	stress-nice.c \
  215 	stress-nop.c \
  216 	stress-null.c \
  217 	stress-numa.c \
  218 	stress-oom-pipe.c \
  219 	stress-opcode.c \
  220 	stress-open.c \
  221 	stress-pci.c \
  222 	stress-personality.c \
  223 	stress-physpage.c \
  224 	stress-pidfd.c \
  225 	stress-ping-sock.c \
  226 	stress-pipe.c \
  227 	stress-pipeherd.c \
  228 	stress-pkey.c \
  229 	stress-poll.c \
  230 	stress-prctl.c \
  231 	stress-prefetch.c \
  232 	stress-procfs.c \
  233 	stress-pthread.c \
  234 	stress-ptrace.c \
  235 	stress-pty.c \
  236 	stress-quota.c \
  237 	stress-qsort.c \
  238 	stress-radixsort.c \
  239 	stress-ramfs.c \
  240 	stress-rawdev.c \
  241 	stress-rawpkt.c \
  242 	stress-rawsock.c \
  243 	stress-rawudp.c \
  244 	stress-rdrand.c \
  245 	stress-readahead.c \
  246 	stress-reboot.c \
  247 	stress-remap-file-pages.c \
  248 	stress-rename.c \
  249 	stress-resources.c \
  250 	stress-revio.c \
  251 	stress-rlimit.c \
  252 	stress-rmap.c \
  253 	stress-rseq.c \
  254 	stress-rtc.c \
  255 	stress-sctp.c \
  256 	stress-schedpolicy.c \
  257 	stress-seal.c \
  258 	stress-seccomp.c \
  259 	stress-secretmem.c \
  260 	stress-seek.c \
  261 	stress-sem.c \
  262 	stress-sem-sysv.c \
  263 	stress-sendfile.c \
  264 	stress-session.c \
  265 	stress-set.c \
  266 	stress-shellsort.c \
  267 	stress-shm.c \
  268 	stress-shm-sysv.c \
  269 	stress-sigabrt.c \
  270 	stress-sigchld.c \
  271 	stress-sigfd.c \
  272 	stress-sigfpe.c \
  273 	stress-sigio.c \
  274 	stress-signal.c \
  275 	stress-signest.c \
  276 	stress-sigpending.c \
  277 	stress-sigpipe.c \
  278 	stress-sigq.c \
  279 	stress-sigrt.c \
  280 	stress-sigsegv.c \
  281 	stress-sigsuspend.c \
  282 	stress-sigtrap.c \
  283 	stress-skiplist.c \
  284 	stress-sleep.c \
  285 	stress-smi.c \
  286 	stress-sock.c \
  287 	stress-sockabuse.c \
  288 	stress-sockdiag.c \
  289 	stress-sockfd.c \
  290 	stress-sockpair.c \
  291 	stress-sockmany.c \
  292 	stress-softlockup.c \
  293 	stress-spawn.c \
  294 	stress-splice.c \
  295 	stress-stack.c \
  296 	stress-stackmmap.c \
  297 	stress-str.c \
  298 	stress-stream.c \
  299 	stress-swap.c \
  300 	stress-switch.c \
  301 	stress-sync-file.c \
  302 	stress-sysbadaddr.c \
  303 	stress-sysinfo.c \
  304 	stress-sysinval.c \
  305 	stress-sysfs.c \
  306 	stress-tee.c \
  307 	stress-timer.c \
  308 	stress-timerfd.c \
  309 	stress-tlb-shootdown.c \
  310 	stress-tmpfs.c \
  311 	stress-tree.c \
  312 	stress-tsc.c \
  313 	stress-tsearch.c \
  314 	stress-tun.c \
  315 	stress-udp.c \
  316 	stress-udp-flood.c \
  317 	stress-unshare.c \
  318 	stress-uprobe.c \
  319 	stress-urandom.c \
  320 	stress-userfaultfd.c \
  321 	stress-utime.c \
  322 	stress-vdso.c \
  323 	stress-vecmath.c \
  324 	stress-verity.c \
  325 	stress-vforkmany.c \
  326 	stress-vm.c \
  327 	stress-vm-addr.c \
  328 	stress-vm-rw.c \
  329 	stress-vm-segv.c \
  330 	stress-vm-splice.c \
  331 	stress-wait.c \
  332 	stress-watchdog.c \
  333 	stress-wcstr.c \
  334 	stress-x86syscall.c \
  335 	stress-xattr.c \
  336 	stress-yield.c \
  337 	stress-zero.c \
  338 	stress-zlib.c \
  339 	stress-zombie.c \
  340 
  341 #
  342 # Stress core
  343 #
  344 CORE_SRC = \
  345 	core-affinity.c \
  346 	core-cache.c \
  347 	core-cpu.c \
  348 	core-hash.c \
  349 	core-helper.c \
  350 	core-ignite-cpu.c \
  351 	core-io-priority.c \
  352 	core-job.c \
  353 	core-limit.c \
  354 	core-log.c \
  355 	core-madvise.c \
  356 	core-mincore.c \
  357 	core-mlock.c \
  358 	core-mmap.c \
  359 	core-module.c \
  360 	core-mounts.c \
  361 	core-mwc.c \
  362 	core-net.c \
  363 	core-out-of-memory.c \
  364 	core-parse-opts.c \
  365 	core-perf.c \
  366 	core-sched.c \
  367 	core-setting.c \
  368 	core-shim.c \
  369 	core-smart.c \
  370 	core-thermal-zone.c \
  371 	core-time.c \
  372 	core-thrash.c \
  373 	core-ftrace.c \
  374 	core-try-open.c \
  375 	core-vmstat.c \
  376 	stress-ng.c
  377 
  378 SRC = $(CORE_SRC) $(STRESS_SRC)
  379 OBJS = $(SRC:.c=.o)
  380 
  381 APPARMOR_PARSER=/sbin/apparmor_parser
  382 
  383 all: makeconfig
  384 	+$(MAKE) stress-ng VERBOSE=$(VERBOSE)
  385 
  386 #
  387 #  Load in and set flags based on config
  388 #
  389 -include config
  390 CFLAGS += $(CONFIG_CFLAGS)
  391 LDFLAGS += $(CONFIG_LDFLAGS)
  392 OBJS += $(CONFIG_OBJS)
  393 
  394 .SUFFIXES: .c .o
  395 
  396 .o: Makefile
  397 
  398 %.o: %.c stress-ng.h config.h git-commit-id.h
  399 	$(Q)echo "CC $<"
  400 	$(V)$(CC) $(CFLAGS) -c -o $@ $<
  401 
  402 stress-ng: $(OBJS)
  403 	$(Q)echo "LD $@"
  404 	$(V)$(CC) $(CPPFLAGS) $(CFLAGS) $(OBJS) -lm $(LDFLAGS) -o $@
  405 	$(V)sync
  406 
  407 config.h:
  408 	+$(MAKE) -f Makefile.config STATIC=$(STATIC) -j
  409 
  410 .PHONY:
  411 makeconfig: config.h
  412 
  413 #
  414 #  generate apparmor data using minimal core utils tools from apparmor
  415 #  parser output
  416 #
  417 apparmor-data.o: usr.bin.pulseaudio.eg
  418 	$(V)$(APPARMOR_PARSER) -Q usr.bin.pulseaudio.eg  -o apparmor-data.bin
  419 	$(V)echo "#include <stddef.h>" > apparmor-data.c
  420 	$(V)echo "char g_apparmor_data[]= { " >> apparmor-data.c
  421 	$(V)od -tx1 -An -v < apparmor-data.bin | \
  422 		sed 's/[0-9a-f][0-9a-f]/0x&,/g' | \
  423 		sed '$$ s/.$$//' >> apparmor-data.c
  424 	$(V)echo "};" >> apparmor-data.c
  425 	$(V)echo "const size_t g_apparmor_data_len = sizeof(g_apparmor_data);" >> apparmor-data.c
  426 	$(Q)echo "CC $<"
  427 	$(V)$(CC) -c apparmor-data.c -o apparmor-data.o
  428 	$(V)rm -rf apparmor-data.c apparmor-data.bin
  429 
  430 #
  431 #  extract the PER_* personality enums
  432 #
  433 personality.h:
  434 	$(V)$(CPP) $(CONFIG_CFLAGS) core-personality.c | $(GREP) -e "PER_[A-Z0-9]* =.*," | cut -d "=" -f 1 \
  435 	| sed "s/.$$/,/" > personality.h
  436 	$(Q)echo "MK personality.h"
  437 
  438 stress-personality.c: personality.h
  439 
  440 #
  441 #  extract IORING_OP enums and #define HAVE_ prefixed values
  442 #  so we can check if these enums exist
  443 #
  444 io-uring.h:
  445 	$(V)$(CPP) $(CFLAGS) core-io-uring.c  | $(GREP) IORING_OP | sed 's/,//' | \
  446 	sed 's/IORING_OP_/#define HAVE_IORING_OP_/' > io-uring.h
  447 	$(Q)echo "MK io-uring.h"
  448 
  449 stress-io-uring.c: io-uring.h
  450 
  451 core-perf.o: core-perf.c core-perf-event.c
  452 	$(V)$(CC) $(CFLAGS) -E core-perf-event.c | $(GREP) "PERF_COUNT" | \
  453 	sed 's/,/ /' | sed s/'^ *//' | \
  454 	awk {'print "#define _SNG_" $$1 " (1)"'} > core-perf-event.h
  455 	$(Q)echo CC $<
  456 	$(V)$(CC) $(CFLAGS) -c -o $@ $<
  457 
  458 stress-vecmath.o: stress-vecmath.c
  459 	$(Q)echo CC $<
  460 	$(V)$(CC) $(CFLAGS) -fno-builtin -c -o $@ $<
  461 
  462 #
  463 #  define STRESS_GIT_COMMIT_ID
  464 #
  465 git-commit-id.h:
  466 	$(Q)echo "MK $@"
  467 	@if [ -e .git/HEAD -a -e .git/index ]; then \
  468 		echo "#define STRESS_GIT_COMMIT_ID \"$(shell git rev-parse HEAD)\"" > $@ ; \
  469 	else \
  470 		echo "#define STRESS_GIT_COMMIT_ID \"\"" > $@ ; \
  471 	fi
  472 
  473 $(OBJS): stress-ng.h Makefile
  474 
  475 stress-ng.1.gz: stress-ng.1
  476 	$(V)gzip -c $< > $@
  477 
  478 .PHONY: dist
  479 dist:
  480 	rm -rf stress-ng-$(VERSION)
  481 	mkdir stress-ng-$(VERSION)
  482 	cp -rp Makefile Makefile.config $(SRC) stress-ng.h stress-ng.1 \
  483 		core-personality.c core-io-uring.c \
  484 		COPYING syscalls.txt mascot README.md \
  485 		stress-af-alg-defconfigs.h README.Android test snap \
  486 		TODO core-perf-event.c usr.bin.pulseaudio.eg \
  487 		stress-version.h bash-completion example-jobs .travis.yml \
  488 		kernel-coverage.sh code-of-conduct.txt stress-ng-$(VERSION)
  489 	tar -Jcf stress-ng-$(VERSION).tar.xz stress-ng-$(VERSION)
  490 	rm -rf stress-ng-$(VERSION)
  491 
  492 .PHONY: pdf
  493 pdf:
  494 	man -t ./stress-ng.1 | ps2pdf - > stress-ng.pdf
  495 
  496 
  497 .PHONY: clean
  498 clean:
  499 	$(V)rm -f stress-ng $(OBJS) stress-ng.1.gz stress-ng.pdf
  500 	$(V)rm -f stress-ng-$(VERSION).tar.xz
  501 	$(V)rm -f io-uring.h
  502 	$(V)rm -f git-commit-id.h
  503 	$(V)rm -f perf-event.h
  504 	$(V)rm -f personality.h
  505 	$(V)rm -f apparmor-data.bin
  506 	$(V)rm -f *.o
  507 	$(V)rm -f config config.h
  508 	$(V)rm -f tags
  509 
  510 .PHONY: fast-test-all
  511 fast-test-all: all
  512 	STRESS_NG=./stress-ng debian/tests/fast-test-all
  513 
  514 .PHONY: lite-test
  515 lite-test: all
  516 	STRESS_NG=./stress-ng debian/tests/lite-test
  517 
  518 .PHONY: slow-test-all
  519 slow-test-all: all
  520 	./stress-ng --seq 0 -t 15 --pathological --verbose --times --tz --metrics
  521 
  522 .PHONY: tags
  523 tags:
  524 	ctags -R --extra=+f --c-kinds=+p *
  525 
  526 .PHONY: install
  527 install: stress-ng stress-ng.1.gz
  528 	mkdir -p ${DESTDIR}${BINDIR}
  529 	cp stress-ng ${DESTDIR}${BINDIR}
  530 	mkdir -p ${DESTDIR}${MANDIR}
  531 ifneq ($(MAN_COMPRESS),0)
  532 	cp stress-ng.1.gz ${DESTDIR}${MANDIR}
  533 else
  534 	cp stress-ng.1 ${DESTDIR}${MANDIR}
  535 endif
  536 	mkdir -p ${DESTDIR}${JOBDIR}
  537 	cp -rp example-jobs/*.job ${DESTDIR}${JOBDIR}
  538 	mkdir -p ${DESTDIR}${BASHDIR}
  539 	cp bash-completion/stress-ng ${DESTDIR}${BASHDIR}