| 1 | # Copyright (C) 2010-2021 Daniel Baumann <[email protected]> |
| 2 | # |
| 3 | # SPDX-License-Identifier: MIT |
| 4 | # |
| 5 | # Permission to use, copy, modify, distribute, and sell this software and its |
| 6 | # documentation for any purpose is hereby granted without fee, provided that |
| 7 | # the above copyright notice appear in all copies and that both that |
| 8 | # copyright notice and this permission notice appear in supporting |
| 9 | # documentation, and that the name of the authors not be used in |
| 10 | # advertising or publicity pertaining to distribution of the software without |
| 11 | # specific, written prior permission. The authors makes no representations |
| 12 | # about the suitability of this software for any purpose. It is provided |
| 13 | # "as is" without express or implied warranty. |
| 14 | # |
| 15 | # THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 16 | # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 17 | # EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 18 | # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 19 | # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 20 | # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 21 | # PERFORMANCE OF THIS SOFTWARE. |
| 22 | |
| 23 | SHELL := sh -e |
| 24 | |
| 25 | all: build |
| 26 | |
| 27 | ast_dp501fw.h: |
| 28 | @echo "# Getting sources" |
| 29 | wget https://gitlab.freedesktop.org/xorg/driver/xf86-video-ast/raw/master/src/ast_dp501fw.h -O ast_dp501fw.h || \ |
| 30 | curl https://gitlab.freedesktop.org/xorg/driver/xf86-video-ast/raw/master/src/ast_dp501fw.h -o ast_dp501fw.h |
| 31 | |
| 32 | ast_dp501_fw.bin: ast_dp501fw.h |
| 33 | @echo "# Creating firmware" |
| 34 | grep ^0x ast_dp501fw.h | sed -e 's|,};$$|,|' | xxd -r -p - ast_dp501_fw.bin |
| 35 | |
| 36 | build: ast_dp501_fw.bin |
| 37 | |
| 38 | install: build |
| 39 | @echo "# Installing firmware" |
| 40 | mkdir -p $(DESTDIR)/lib/firmware |
| 41 | cp *.bin $(DESTDIR)/lib/firmware |
| 42 | |
| 43 | uninstall: |
| 44 | @echo "# Uninstalling firmware" |
| 45 | for FILE in *.bin; do rm -f $(DESTDIR)/lib/firmware/$${FILE}; done |
| 46 | rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/lib/firmware > /dev/null 2>&1 || true |
| 47 | |
| 48 | reinstall: clean uninstall install |
| 49 | |
| 50 | clean: |
| 51 | @echo "# Removing firmware" |
| 52 | rm -f *.bin |
| 53 | |
| 54 | distclean: clean |
| 55 | @echo "# Removing sources" |
| 56 | rm -f *.h |