FDD-book/examples/part-07/ch29-portability/final/Makefile
Edson Brandi 6e6dac94fe Add book companion files under examples/
Organize companion code and materials by book part:

  part-01/      Foundations
  part-02/      Kernel & driver fundamentals
  part-03/      Character & block devices
  part-04/      Networking & storage
  part-05/      Buses & advanced topics
  part-06/      Debugging & performance
  part-07/      Real-world drivers
  appendices/   Supplementary material
  README.md     Overview and build instructions
2026-04-25 16:51:00 +00:00

38 lines
1.1 KiB
Makefile

# Makefile for portdrv - Chapter 29 final reference driver.
#
# Builds portdrv.ko with one or more backends selected at build time.
# If no backend is selected, the Makefile falls back to SIM so that a
# plain `make` always produces a loadable module.
#
# Usage:
# make # SIM backend only (default).
# make PORTDRV_WITH_PCI=yes # PCI backend only.
# make PORTDRV_WITH_SIM=yes # SIM backend only (explicit).
# make PORTDRV_WITH_PCI=yes PORTDRV_WITH_SIM=yes
# # Both backends.
KMOD= portdrv
SRCS= portdrv_core.c
.if defined(PORTDRV_WITH_PCI) && ${PORTDRV_WITH_PCI} == "yes"
SRCS+= portdrv_pci.c
CFLAGS+= -DPORTDRV_WITH_PCI
.endif
.if defined(PORTDRV_WITH_SIM) && ${PORTDRV_WITH_SIM} == "yes"
SRCS+= portdrv_sim.c
CFLAGS+= -DPORTDRV_WITH_SIM
.endif
.if !defined(PORTDRV_WITH_PCI) && !defined(PORTDRV_WITH_SIM)
SRCS+= portdrv_sim.c
CFLAGS+= -DPORTDRV_WITH_SIM
.endif
SRCS+= device_if.h bus_if.h pci_if.h
CFLAGS+= -I${.CURDIR}
SYSDIR?= /usr/src/sys
.include <bsd.kmod.mk>