wenlong.zhang | 52052d1 | 2023-01-13 15:42:57 +0800 | [diff] [blame] | 1 | LOCAL_PATH = $(shell pwd) |
| 2 | |
| 3 | MIN_GCC_VERSION = "10" |
| 4 | GCC_VERSION := "`$(CC) -dumpversion | cut -f1 -d'.'`" |
| 5 | IS_GCC_ABOVE_MIN_VERSION := $(shell expr "$(GCC_VERSION)" ">=" "$(MIN_GCC_VERSION)") |
| 6 | ifeq "$(IS_GCC_ABOVE_MIN_VERSION)" "1" |
| 7 | CFLAGS += -std=gnu++20 |
| 8 | endif |
| 9 | |
Dongjin Kim | 3e663fc | 2025-04-21 13:43:45 +0900 | [diff] [blame] | 10 | LDFLAGS += -Wl,--no-as-needed -lpthread -L$(STAGING_DIR)/usr/lib |
wenlong.zhang | 52052d1 | 2023-01-13 15:42:57 +0800 | [diff] [blame] | 11 | CFLAGS += -Wall -Wno-unknown-pragmas -Wno-format -Wno-format-security -Wno-error=unused-result \ |
| 12 | -O3 -fexceptions -fnon-call-exceptions -D_GNU_SOURCE -I$(STAGING_DIR)/usr/include |
| 13 | CFLAGS += -I$(STAGING_DIR)/usr/include/ -I$(STAGING_DIR)/usr/include/libdrm/ |
| 14 | LDFLAGS += -L$(STAGING_DIR)/usr/lib -ldrm |
| 15 | |
| 16 | drm_setcrtc_SRCS = \ |
| 17 | $(LOCAL_PATH)/drm_setcrtc.c \ |
| 18 | $(NULL) |
leng.fang | c7e4bb7 | 2023-12-25 08:48:45 +0000 | [diff] [blame] | 19 | |
| 20 | OUT_DIR ?= . |
wenlong.zhang | 52052d1 | 2023-01-13 15:42:57 +0800 | [diff] [blame] | 21 | # --------------------------------------------------------------------- |
| 22 | # Build rules |
| 23 | BUILD_TARGETS = drm_setcrtc |
| 24 | |
| 25 | .PHONY: all install uninstall clean |
| 26 | |
| 27 | drm_setcrtc: $(drm_setcrtc_SRCS) |
leng.fang | c7e4bb7 | 2023-12-25 08:48:45 +0000 | [diff] [blame] | 28 | $(CC) $(CFLAGS) -L$(LOCAL_PATH) $(LDFLAGS) -o $(OUT_DIR)/$@ $^ $(LDLIBS) |
wenlong.zhang | 52052d1 | 2023-01-13 15:42:57 +0800 | [diff] [blame] | 29 | |
| 30 | all: $(BUILD_TARGETS) |
| 31 | |
| 32 | clean: |
leng.fang | c7e4bb7 | 2023-12-25 08:48:45 +0000 | [diff] [blame] | 33 | rm -f *.o $(OUT_DIR)/$(BUILD_TARGETS) |
wenlong.zhang | 52052d1 | 2023-01-13 15:42:57 +0800 | [diff] [blame] | 34 | |
| 35 | install: |
leng.fang | c7e4bb7 | 2023-12-25 08:48:45 +0000 | [diff] [blame] | 36 | install -m 755 $(OUT_DIR)/drm_setcrtc $(TARGET_DIR)/usr/bin/ |
wenlong.zhang | 52052d1 | 2023-01-13 15:42:57 +0800 | [diff] [blame] | 37 | |
| 38 | uninstall: |
| 39 | rm -f $(TARGET_DIR)/usr/bin/drm_setcrtc |
| 40 | |