-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: * Support program prefix. * Support install target. * Support CFLAGS and LDFLAGS from build system. module: * depmod should be optional. * Accept installation target. * Support modules_install target (avoid removal of leftovers)
- Loading branch information
Showing
2 changed files
with
40 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
prefix := /usr/local | ||
bindir := $(prefix)/bin | ||
PROGRAM_PREFIX := | ||
CC ?= gcc | ||
CFLAGS ?= | ||
LDFLAGS ?= | ||
EXTRA_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE | ||
INSTALL ?= install | ||
|
||
all: reg_rw dma_to_device dma_from_device performance test_chrdev | ||
PROGRAMS = $(PROGRAM_PREFIX)reg_rw $(PROGRAM_PREFIX)dma_to_device $(PROGRAM_PREFIX)dma_from_device $(PROGRAM_PREFIX)performance $(PROGRAM_PREFIX)test_chrdev | ||
|
||
dma_to_device: dma_to_device.o | ||
$(CC) -lrt -o $@ $< -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE | ||
all: $(PROGRAMS) | ||
|
||
dma_from_device: dma_from_device.o | ||
$(CC) -lrt -o $@ $< -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE | ||
$(PROGRAM_PREFIX)dma_to_device: dma_to_device.o | ||
$(CC) -lrt -o $@ $< $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) | ||
|
||
performance: performance.o | ||
$(CC) -o $@ $< -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE | ||
$(PROGRAM_PREFIX)dma_from_device: dma_from_device.o | ||
$(CC) -lrt -o $@ $< $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) | ||
|
||
reg_rw: reg_rw.o | ||
$(CC) -o $@ $< | ||
$(PROGRAM_PREFIX)performance: performance.o | ||
$(CC) -o $@ $< $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) | ||
|
||
test_chrdev: test_chrdev.o | ||
$(CC) -o $@ $< | ||
$(PROGRAM_PREFIX)reg_rw: reg_rw.o | ||
$(CC) -o $@ $< $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) | ||
|
||
$(PROGRAM_PREFIX)test_chrdev: test_chrdev.o | ||
$(CC) -o $@ $< $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) | ||
|
||
%.o: %.c | ||
$(CC) -c -std=c99 -o $@ $< -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE | ||
$(CC) -c -std=c99 -o $@ $< $(CFLAGS) $(EXTRA_CFLAGS) | ||
|
||
clean: | ||
rm -rf reg_rw *.o *.bin dma_to_device dma_from_device performance test_chrdev | ||
rm -rf *.o *.bin | ||
rm -fr $(PROGRAMS) | ||
|
||
install: all | ||
install -d -m 0755 "$(DESTDIR)$(bindir)" | ||
install -m 0755 $(PROGRAMS) "$(DESTDIR)$(bindir)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters