Set syntax highlighting colors PowerShell to match my white background theme.
# 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
ifeq '' '$(prefix)'
ifneq '' '$(HOME)'
prefix = $(HOME)/usr
else
$(error HOME env var and prefix var are not set!)
endif
endif
bindir = $(prefix)/bin
mandir = $(prefix)/share/man
man1dir = $(mandir)/man1
host_os = unix
ifneq '' '$(COMSPEC)'
host_os = windows
endif
UNAME := $(shell uname -s)
ifneq '' '$(filter MINGW%,$(UNAME))'
host_os_emu = mingw
endif
ifneq '' '$(filter CYGWIN%,$(UNAME))'
host_os_emu = cygwin
endif
CC=gcc
LD=gcc
# CC=i686-pc-cygwin-gcc-3 -mno-cygwin
# LD=i686-pc-cygwin-gcc-3 -mno-cygwin
CFLAGS = -std=c99 -O2 -Wall -pedantic -g
LDFLAGS =
ifeq 'windows' '$(host_os)'
CFLAGS += -mwindows
endif
EXE_SUFFIX =
ifeq 'windows' '$(host_os)'
EXE_SUFFIX = .exe
endif
C_FILES = $(wildcard *.c)
O_FILES = $(C_FILES:.c=.o)
APP_FILES = smspdu-pack$(EXE_SUFFIX) smspdu-unpack$(EXE_SUFFIX)
.PHONY: all
all: $(APP_FILES)
smspdu-pack$(EXE_SUFFIX): smspdu-pack.o
$(LD) $(LDFLAGS) -o $@ $^
strip $@
smspdu-unpack$(EXE_SUFFIX): smspdu-unpack.o
$(LD) $(LDFLAGS) -o $@ $^
strip $@
%.o: %.c $(MAKEFILE_LIST)
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: check
check: $(APP_FILES)
./smspdu-pack$(EXE_SUFFIX) <test1.in >test1.out
cmp test1.out.must test1.out
./smspdu-unpack$(EXE_SUFFIX) <test1.out >test1.in.out
cmp test1.in test1.in.out || :
./smspdu-pack$(EXE_SUFFIX) <test2.in >test2.out
cmp test2.out.must test2.out
./smspdu-unpack$(EXE_SUFFIX) <test2.out >test2.in.out
cmp test2.in test2.in.out
.PHONY: install
install: $(APP_FILES)
[ -d $(bindir) ] || mkdir -p $(bindir)
install -m 755 smspdu-pack$(EXE_SUFFIX) $(bindir)
install -m 755 smspdu-unpack$(EXE_SUFFIX) $(bindir)
[ -d $(man1dir) ] || mkdir -p $(man1dir)
install -m 755 printarg.1 $(man1dir)
.PHONY: uninstall
uninstall:
for file in \
$(bindir)/smspdu-pack$(EXE_SUFFIX) $(bindir)/smspdu-unpack$(EXE_SUFFIX) $(man1dir)/printarg.1; do \
[ -e $$file ] && if rm $$file; then :; else echo Unable to delete $$file; exit 1; fi || :; \
done
.PHONY: distclean
distclean: clean
.PHONY: clean
clean:
rm -f $(APP_FILES) $(O_FILES) $(wildcard *.out)