-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michael Buesch <[email protected]>
- Loading branch information
0 parents
commit f5d2338
Showing
9 changed files
with
1,596 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
morse_encoder | ||
|
||
dep | ||
obj | ||
.*.swp | ||
~* |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# The toolchain definitions | ||
CC = cc | ||
SPARSE = sparse | ||
|
||
V = @ # Verbose build: make V=1 | ||
C = 0 # Sparsechecker build: make C=1 | ||
Q = $(V:1=) | ||
QUIET_CC = $(Q:@=@echo ' CC '$@;)$(CC) | ||
QUIET_DEPEND = $(Q:@=@echo ' DEPEND '$@;)$(CC) | ||
ifeq ($(C),1) | ||
QUIET_SPARSE = $(Q:@=@echo ' SPARSE '$@;)$(SPARSE) | ||
else | ||
QUIET_SPARSE = @/bin/true | ||
endif | ||
|
||
PREFIX ?= /usr/local | ||
CFLAGS ?= -Os -fomit-frame-pointer | ||
CFLAGS += -std=c99 -Wall -pedantic -D_BSD_SOURCE | ||
LDFLAGS ?= | ||
|
||
SRCS = morse_encoder.c | ||
BIN = morse_encoder | ||
|
||
.SUFFIXES: | ||
.PHONY: all install clean distclean | ||
.DEFAULT_GOAL := all | ||
|
||
DEPS = $(sort $(patsubst %.c,dep/%.d,$(1))) | ||
OBJS = $(sort $(patsubst %.c,obj/%.o,$(1))) | ||
|
||
# Generate dependencies | ||
$(call DEPS,$(SRCS)): dep/%.d: %.c | ||
@mkdir -p $(dir $@) | ||
$(QUIET_DEPEND) -o $@.tmp -MM -MG -MT "$@ $(patsubst dep/%.d,obj/%.o,$@)" $(CFLAGS) $< && mv -f $@.tmp $@ | ||
|
||
-include $(call DEPS,$(SRCS)) | ||
|
||
# Generate object files | ||
$(call OBJS,$(SRCS)): obj/%.o: | ||
@mkdir -p $(dir $@) | ||
$(QUIET_SPARSE) $(SPARSEFLAGS) $< | ||
$(QUIET_CC) -o $@ -c $(CFLAGS) $< | ||
|
||
all: $(BIN) | ||
|
||
$(BIN): $(call OBJS,$(SRCS)) | ||
$(QUIET_CC) $(CFLAGS) -o $(BIN) $(call OBJS,$(SRCS)) $(LDFLAGS) | ||
|
||
clean: | ||
-rm -Rf obj dep *.orig *.rej *~ | ||
|
||
distclean: clean | ||
-rm -f $(BIN) |
Oops, something went wrong.