view msgup/Makefile @ 632:882ed7909868

Show seconds in Windows clock. Works starting with Windows 10 build 14393.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Wed, 05 Apr 2017 15:12:30 +0300
parents 41c5dab96724
children
line wrap: on
line source

# Copyright (C) 2008 by Oleksandr Gavenko <gavenkoa@gmail.com>

SHELL = /bin/sh

# Disable built in pattern rules.
MAKEFLAGS += -r
# Disable built in variables.
MAKEFLAGS += -R
# Disable built in suffix rules.
.SUFFIXES:
# Delete target file if command fails.
.DELETE_ON_ERROR:
# Default target.
.DEFAULT_GOAL = all

BUILD_SCRIPTS = $(MAKEFILE_LIST)

ifeq '' '$(prefix)'
  ifneq '' '$(HOME)'
    prefix = $(HOME)/usr
  else
    $(error HOME env var and prefix var are not set!)
  endif
endif

bindir = $(prefix)/bin

host_os = linux
ifneq '' '$(COMSPEC)'
  host_os = windows
endif

CC = gcc
CFLAGS = -std=c99 -Wall -pedantic -O2
LD = gcc
LDFLAGS = -mwindows
LIBS =

NAME = msgup
APP = $(NAME).exe

MAN1_FILE = $(NAME).1
HTML_FILE = $(NAME).html

.PHONY: all
all: dist

run: dist
ifeq 'windows' '$(host_os)'
	./$(APP) title message
	./$(APP) || :
	./$(APP) title message dust || :
endif

.PHONY: dist
install: $(APP)
ifeq 'windows' '$(host_os)'
	[ -d $(bindir) ] || mkdir -p $(bindir)
	install -m 755 $(APP) $(bindir)
endif

.PHONY: dist
dist: $(APP)

$(APP): $(NAME).o
ifeq 'windows' '$(host_os)'
	$(LD) $(LDFLAGS) -o $(APP) $^ $(LIBS)
	strip --strip-all $@
endif

%.o: %.c $(BUILD_SCRIPTS)
ifeq 'windows' '$(host_os)'
	$(CC) $(CFLAGS) -c -o $@ $<
endif

.PHONY: doc
doc: $(MAN1_FILE) $(HTML_FILE)

$(MAN1_FILE): $(APP) $(BUILD_SCRIPTS)
	help2man --section=1 --no-info -o $@ ./$<

$(HTML_FILE): $(MAN1_FILE) $(BUILD_SCRIPTS)
	man2html $< | tail -n +2  >$@

.PHONY: distclean
distclean: clean

.PHONY: clean
clean:
	rm -f $(APP) $(NAME).o $(MAN1_FILE) $(HTML_FILE)