"Fossies" - the Fresh Open Source Software Archive

Member "stress-ng-0.09.56/Makefile" (15 Mar 2019, 9550 Bytes) of package /linux/privat/stress-ng-0.09.56.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.09.55_vs_0.09.56.

    1 #
    2 # Copyright (C) 2013-2019 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.09.56
   20 #
   21 # Codename "portable pressure producer"
   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 GREP = grep
   37 #
   38 # SunOS requires special grep for -e support
   39 #
   40 KERNEL=$(shell uname -s)
   41 NODENAME=$(shell uname -n)
   42 ifeq ($(KERNEL),SunOS)
   43 ifneq ($(NODENAME),dilos)
   44 GREP = /usr/xpg4/bin/grep
   45 endif
   46 endif
   47 
   48 #
   49 # Check for KFreeBSD
   50 #
   51 ifeq ($(KERNEL),GNU/kFreeBSD)
   52 CFLAGS += -D__FreeBSD_Kernel__
   53 endif
   54 
   55 #
   56 # Static flags, only to be used when using GCC
   57 #
   58 ifeq ($(STATIC),1)
   59 LDFLAGS += -static
   60 CFLAGS += -DBUILD_STATIC
   61 endif
   62 
   63 BINDIR=/usr/bin
   64 MANDIR=/usr/share/man/man1
   65 JOBDIR=/usr/share/stress-ng/example-jobs
   66 
   67 #
   68 #  Stressors
   69 #
   70 STRESS_SRC = \
   71 	stress-access.c \
   72 	stress-affinity.c \
   73 	stress-af-alg.c \
   74 	stress-aio.c \
   75 	stress-aio-linux.c \
   76 	stress-apparmor.c \
   77 	stress-atomic.c \
   78 	stress-bad-altstack.c \
   79 	stress-bigheap.c \
   80 	stress-bind-mount.c \
   81 	stress-branch.c \
   82 	stress-brk.c \
   83 	stress-bsearch.c \
   84 	stress-cache.c \
   85 	stress-cap.c \
   86 	stress-chdir.c \
   87 	stress-chmod.c \
   88 	stress-chown.c \
   89 	stress-chroot.c \
   90 	stress-clock.c \
   91 	stress-clone.c \
   92 	stress-close.c \
   93 	stress-context.c \
   94 	stress-copy-file.c \
   95 	stress-cpu.c \
   96 	stress-cpu-online.c \
   97 	stress-crypt.c \
   98 	stress-cyclic.c \
   99 	stress-daemon.c \
  100 	stress-dccp.c \
  101 	stress-dentry.c \
  102 	stress-dev.c \
  103 	stress-dev-shm.c \
  104 	stress-dir.c \
  105 	stress-dirdeep.c \
  106 	stress-dnotify.c \
  107 	stress-dup.c \
  108 	stress-dynlib.c \
  109 	stress-efivar.c \
  110 	stress-enosys.c \
  111 	stress-epoll.c \
  112 	stress-eventfd.c \
  113 	stress-exec.c \
  114 	stress-fallocate.c \
  115 	stress-fanotify.c \
  116 	stress-fault.c \
  117 	stress-fcntl.c \
  118 	stress-file-ioctl.c \
  119 	stress-fiemap.c \
  120 	stress-fifo.c \
  121 	stress-filename.c \
  122 	stress-flock.c \
  123 	stress-fork.c \
  124 	stress-fp-error.c \
  125 	stress-fstat.c \
  126 	stress-full.c \
  127 	stress-funccall.c \
  128 	stress-futex.c \
  129 	stress-get.c \
  130 	stress-getrandom.c \
  131 	stress-getdent.c \
  132 	stress-handle.c \
  133 	stress-hdd.c \
  134 	stress-heapsort.c \
  135 	stress-hrtimers.c \
  136 	stress-hsearch.c \
  137 	stress-icache.c \
  138 	stress-icmp-flood.c \
  139 	stress-idle-page.c \
  140 	stress-inode-flags.c \
  141 	stress-inotify.c \
  142 	stress-iomix.c \
  143 	stress-ioport.c \
  144 	stress-ioprio.c \
  145 	stress-iosync.c \
  146 	stress-ipsec-mb.c \
  147 	stress-itimer.c \
  148 	stress-kcmp.c \
  149 	stress-key.c \
  150 	stress-kill.c \
  151 	stress-klog.c \
  152 	stress-lease.c \
  153 	stress-link.c \
  154 	stress-lockbus.c \
  155 	stress-locka.c \
  156 	stress-lockf.c \
  157 	stress-lockofd.c \
  158 	stress-longjmp.c \
  159 	stress-loop.c \
  160 	stress-lsearch.c \
  161 	stress-madvise.c \
  162 	stress-malloc.c \
  163 	stress-matrix.c \
  164 	stress-matrix-3d.c \
  165 	stress-mcontend.c \
  166 	stress-membarrier.c \
  167 	stress-memcpy.c \
  168 	stress-memfd.c \
  169 	stress-memrate.c \
  170 	stress-memthrash.c \
  171 	stress-mergesort.c \
  172 	stress-mincore.c \
  173 	stress-mknod.c \
  174 	stress-mlock.c \
  175 	stress-mlockmany.c \
  176 	stress-mmap.c \
  177 	stress-mmapaddr.c \
  178 	stress-mmapfixed.c \
  179 	stress-mmapfork.c \
  180 	stress-mmapmany.c \
  181 	stress-mremap.c \
  182 	stress-msg.c \
  183 	stress-msync.c \
  184 	stress-mq.c \
  185 	stress-netdev.c \
  186 	stress-netlink-proc.c \
  187 	stress-nice.c \
  188 	stress-nop.c \
  189 	stress-null.c \
  190 	stress-numa.c \
  191 	stress-oom-pipe.c \
  192 	stress-opcode.c \
  193 	stress-open.c \
  194 	stress-personality.c \
  195 	stress-physpage.c \
  196 	stress-pipe.c \
  197 	stress-pkey.c \
  198 	stress-poll.c \
  199 	stress-prctl.c \
  200 	stress-procfs.c \
  201 	stress-pthread.c \
  202 	stress-ptrace.c \
  203 	stress-pty.c \
  204 	stress-quota.c \
  205 	stress-qsort.c \
  206 	stress-radixsort.c \
  207 	stress-rawdev.c \
  208 	stress-rdrand.c \
  209 	stress-readahead.c \
  210 	stress-remap-file-pages.c \
  211 	stress-rename.c \
  212 	stress-resources.c \
  213 	stress-revio.c \
  214 	stress-rlimit.c \
  215 	stress-rmap.c \
  216 	stress-rtc.c \
  217 	stress-sctp.c \
  218 	stress-schedpolicy.c \
  219 	stress-seal.c \
  220 	stress-seccomp.c \
  221 	stress-seek.c \
  222 	stress-sem.c \
  223 	stress-sem-sysv.c \
  224 	stress-sendfile.c \
  225 	stress-set.c \
  226 	stress-shm.c \
  227 	stress-shm-sysv.c \
  228 	stress-sigfd.c \
  229 	stress-sigfpe.c \
  230 	stress-sigio.c \
  231 	stress-sigpending.c \
  232 	stress-sigpipe.c \
  233 	stress-sigq.c \
  234 	stress-sigrt.c \
  235 	stress-sigsegv.c \
  236 	stress-sigsuspend.c \
  237 	stress-sleep.c \
  238 	stress-socket.c \
  239 	stress-socket-diag.c \
  240 	stress-socket-fd.c \
  241 	stress-socketpair.c \
  242 	stress-softlockup.c \
  243 	stress-spawn.c \
  244 	stress-splice.c \
  245 	stress-stack.c \
  246 	stress-stackmmap.c \
  247 	stress-str.c \
  248 	stress-stream.c \
  249 	stress-swap.c \
  250 	stress-switch.c \
  251 	stress-sync-file.c \
  252 	stress-sysbadaddr.c \
  253 	stress-sysinfo.c \
  254 	stress-sysfs.c \
  255 	stress-tee.c \
  256 	stress-timer.c \
  257 	stress-timerfd.c \
  258 	stress-tlb-shootdown.c \
  259 	stress-tmpfs.c \
  260 	stress-tree.c \
  261 	stress-tsc.c \
  262 	stress-tsearch.c \
  263 	stress-udp.c \
  264 	stress-udp-flood.c \
  265 	stress-unshare.c \
  266 	stress-urandom.c \
  267 	stress-userfaultfd.c \
  268 	stress-utime.c \
  269 	stress-vdso.c \
  270 	stress-vecmath.c \
  271 	stress-vforkmany.c \
  272 	stress-vm.c \
  273 	stress-vm-addr.c \
  274 	stress-vm-rw.c \
  275 	stress-vm-segv.c \
  276 	stress-vm-splice.c \
  277 	stress-wait.c \
  278 	stress-watchdog.c \
  279 	stress-wcstr.c \
  280 	stress-xattr.c \
  281 	stress-yield.c \
  282 	stress-zero.c \
  283 	stress-zlib.c \
  284 	stress-zombie.c \
  285 
  286 #
  287 # Stress core
  288 #
  289 CORE_SRC = \
  290 	core-affinity.c \
  291 	core-cache.c \
  292 	core-cpu.c \
  293 	core-helper.c \
  294 	core-ignite-cpu.c \
  295 	core-io-priority.c \
  296 	core-job.c \
  297 	core-limit.c \
  298 	core-log.c \
  299 	core-madvise.c \
  300 	core-mincore.c \
  301 	core-mlock.c \
  302 	core-mmap.c \
  303 	core-mounts.c \
  304 	core-mwc.c \
  305 	core-net.c \
  306 	core-out-of-memory.c \
  307 	core-parse-opts.c \
  308 	core-perf.c \
  309 	core-sched.c \
  310 	core-setting.c \
  311 	core-shim.c \
  312 	core-thermal-zone.c \
  313 	core-time.c \
  314 	core-thrash.c \
  315 	stress-ng.c
  316 
  317 SRC = $(STRESS_SRC) $(CORE_SRC)
  318 OBJS = $(SRC:.c=.o)
  319 
  320 APPARMOR_PARSER=/sbin/apparmor_parser
  321 
  322 LIB_APPARMOR := -lapparmor
  323 LIB_BSD := -lbsd
  324 LIB_Z := -lz
  325 LIB_CRYPT := -lcrypt
  326 LIB_RT := -lrt
  327 LIB_PTHREAD := -lpthread
  328 LIB_AIO = -laio
  329 LIB_SCTP = -lsctp
  330 LIB_DL = -ldl
  331 
  332 #
  333 #  Load in and set flags based on config
  334 #
  335 -include config
  336 CFLAGS += $(CONFIG_CFLAGS)
  337 LDFLAGS += $(CONFIG_LDFLAGS)
  338 OBJS += $(CONFIG_OBJS)
  339 
  340 all:
  341 ifneq ("$(wildcard config)","")
  342 	$(MAKE) makeconfig
  343 endif
  344 	$(MAKE) stress-ng
  345 
  346 .SUFFIXES: .c .o
  347 
  348 .o: stress-ng.h Makefile
  349 
  350 .c.o: stress-ng.h Makefile $(SRC)
  351 	@echo "CC $<"
  352 	@$(CC) $(CFLAGS) -c -o $@ $<
  353 
  354 stress-ng: $(OBJS)
  355 	@echo "LD $@"
  356 	@$(CC) $(CPPFLAGS) $(CFLAGS) $(OBJS) -lm $(LDFLAGS) -o $@
  357 	@sync
  358 
  359 makeconfig:
  360 	@if [ ! -s config ]; then \
  361 		STATIC=$(STATIC) $(MAKE) -f Makefile.config; \
  362 	fi
  363 
  364 #
  365 #  generate apparmor data using minimal core utils tools from apparmor
  366 #  parser output
  367 #
  368 apparmor-data.o: usr.bin.pulseaudio.eg
  369 	@$(APPARMOR_PARSER) -Q usr.bin.pulseaudio.eg  -o apparmor-data.bin
  370 	@echo "#include <stddef.h>" > apparmor-data.c
  371 	@echo "char g_apparmor_data[]= { " >> apparmor-data.c
  372 	@od -tx1 -An -v < apparmor-data.bin | \
  373 		sed 's/[0-9a-f][0-9a-f]/0x&,/g' | \
  374 		sed '$$ s/.$$//' >> apparmor-data.c
  375 	@echo "};" >> apparmor-data.c
  376 	@echo "const size_t g_apparmor_data_len = sizeof(g_apparmor_data);" >> apparmor-data.c
  377 	@echo "CC $<"
  378 	@$(CC) -c apparmor-data.c -o apparmor-data.o
  379 	@rm -rf apparmor-data.c apparmor-data.bin
  380 
  381 #
  382 #  extract the PER_* personality enums
  383 #
  384 personality.h:
  385 	@$(CPP) core-personality.c | $(GREP) -e "PER_[A-Z0-9]* =.*," | cut -d "=" -f 1 \
  386 	| sed "s/.$$/,/" > personality.h
  387 
  388 stress-personality.c: personality.h
  389 
  390 core-perf.o: core-perf.c core-perf-event.c
  391 	@$(CC) $(CFLAGS) -E core-perf-event.c | grep "PERF_COUNT" | sed 's/,/ /' | \
  392 	awk {'print "#define _SNG_" $$1 " (1)"'} > core-perf-event.h
  393 	@echo CC $<
  394 	@$(CC) $(CFLAGS) -c -o $@ $<
  395 
  396 stress-vecmath.o: stress-vecmath.c
  397 	@echo CC $<
  398 	@$(CC) $(CFLAGS) -fno-builtin -c -o $@ $<
  399 	@touch stress-ng.c
  400 
  401 $(OBJS): stress-ng.h Makefile
  402 
  403 stress-ng.1.gz: stress-ng.1
  404 	gzip -c $< > $@
  405 
  406 .PHONY: dist
  407 dist:
  408 	rm -rf stress-ng-$(VERSION)
  409 	mkdir stress-ng-$(VERSION)
  410 	cp -rp Makefile Makefile.config $(SRC) stress-ng.h stress-ng.1 \
  411 		core-personality.c COPYING syscalls.txt mascot README \
  412 		README.Android test snap smatchify.sh config TODO \
  413 		core-perf-event.c usr.bin.pulseaudio.eg stress-version.h \
  414 		example-jobs .travis.yml stress-ng-$(VERSION)
  415 	tar -Jcf stress-ng-$(VERSION).tar.xz stress-ng-$(VERSION)
  416 	rm -rf stress-ng-$(VERSION)
  417 
  418 .PHONY: pdf
  419 pdf:
  420 	man -t ./stress-ng.1 | ps2pdf - > stress-ng.pdf
  421 
  422 
  423 .PHONY: clean
  424 clean:
  425 	@rm -f stress-ng $(OBJS) stress-ng.1.gz stress-ng.pdf
  426 	@rm -f stress-ng-$(VERSION).tar.xz
  427 	@rm -f personality.h
  428 	@rm -f perf-event.h
  429 	@rm -f apparmor-data.bin
  430 	@rm -f *.o
  431 	@:> config
  432 
  433 .PHONY: fast-test-all
  434 fast-test-all: all
  435 	STRESS_NG=./stress-ng debian/tests/fast-test-all
  436 
  437 .PHONY: slow-test-all
  438 slow-test-all: all
  439 	./stress-ng --seq 0 -t 15 --pathological --verbose --times --tz --metrics
  440 
  441 .PHONY: install
  442 install: stress-ng stress-ng.1.gz
  443 	mkdir -p ${DESTDIR}${BINDIR}
  444 	cp stress-ng ${DESTDIR}${BINDIR}
  445 	mkdir -p ${DESTDIR}${MANDIR}
  446 	cp stress-ng.1.gz ${DESTDIR}${MANDIR}
  447 	mkdir -p ${DESTDIR}${JOBDIR}
  448 	cp -rp example-jobs/*.job ${DESTDIR}${JOBDIR}